summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2012-07-11Strip namelen out of ce_flags into a ce_namelen fieldLibravatar Thomas Gummerer4-6/+12
Strip the name length from the ce_flags field and move it into its own ce_namelen field in struct cache_entry. This will both give us a tiny bit of a performance enhancement when working with long pathnames and is a refactoring for more readability of the code. It enhances readability, by making it more clear what is a flag, and where the length is stored and make it clear which functions use stages in comparisions and which only use the length. It also makes CE_NAMEMASK private, so that users don't mistakenly write the name length in the flags. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09Merge branch 'cw/help-over-network'Libravatar Junio C Hamano1-4/+15
"git help -w $cmd" can show HTML version of documentation for "git-$cmd" by setting help.htmlpath to somewhere other than the default location where the build procedure installs them locally; the variable can even point at a http:// URL. * cw/help-over-network: Allow help.htmlpath to be a URL prefix Add config variable to set HTML path for git-help --web
2012-07-09Merge branch 'js/fast-export-paths-with-spaces'Libravatar Junio C Hamano1-0/+2
"git fast-export" produced an input stream for fast-import without properly quoting pathnames when they contain SPs in them. * js/fast-export-paths-with-spaces: fast-export: quote paths with spaces
2012-07-09Merge branch 'cw/no-detaching-an-unborn'Libravatar Junio C Hamano1-0/+2
"git checkout --detach", when you are still on an unborn branch, should be forbidden, but it wasn't. * cw/no-detaching-an-unborn: git-checkout: disallow --detach on unborn branch
2012-07-09Merge branch 'mm/credential-plumbing'Libravatar Junio C Hamano1-0/+31
Expose the credential API to scripted Porcelain writers. * mm/credential-plumbing: git-remote-mediawiki: update comments to reflect credential support git-remote-mediawiki: add credential support git credential fill: output the whole 'struct credential' add 'git credential' plumbing command
2012-07-09Merge branch 'jc/maint-blame-unique-abbrev'Libravatar Junio C Hamano1-4/+21
"git blame" did not try to make sure the abbreviated commit object names in its output are unique. * jc/maint-blame-unique-abbrev: blame: compute abbreviation width that ensures uniqueness
2012-07-09Merge branch 'rj/platform-pread-may-be-thread-unsafe'Libravatar Junio C Hamano1-2/+2
On Cygwin, the platform pread(3) is not thread safe, just like our own compat/ emulation, and cannot be used in the index-pack program. * rj/platform-pread-may-be-thread-unsafe: index-pack: Disable threading on cygwin
2012-07-09Merge branch 'mm/config-xdg'Libravatar Junio C Hamano1-9/+16
Teach git to read various information from $XDG_CONFIG_HOME/git/ to allow the user to avoid cluttering $HOME. * mm/config-xdg: config: write to $XDG_CONFIG_HOME/git/config file when appropriate Let core.attributesfile default to $XDG_CONFIG_HOME/git/attributes Let core.excludesfile default to $XDG_CONFIG_HOME/git/ignore config: read (but not write) from $XDG_CONFIG_HOME/git/config file
2012-07-04Merge branch 'nd/clone-single-fix'Libravatar Junio C Hamano1-2/+5
"git clone --single-branch" to clone a single branch did not limit the cloning to the specified branch. * nd/clone-single-fix: clone: fix ref selection in --single-branch --branch=xxx
2012-07-02blame: compute abbreviation width that ensures uniquenessLibravatar Junio C Hamano1-4/+21
Julia Lawall noticed that in linux-next repository the commit object 60d5c9f5 (shown with the default abbreviation width baked into "git blame") in output from $ git blame -L 3675,3675 60d5c9f5b -- \ drivers/staging/brcm80211/brcmfmac/wl_iw.c is no longer unique in the repository, which results in "short SHA1 60d5c9f5 is ambiguous". Compute the minimum abbreviation width that ensures uniqueness when the user did not specify the --abbrev option to avoid this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-28Merge branch 'hv/submodule-update-nuke-submodules'Libravatar Junio C Hamano1-6/+0
"git add" allows adding a regular file to the path where a submodule used to exist, but "git update-index" does not allow an equivalent operation to Porcelain writers.
2012-06-28Merge branch 'nd/stream-pack-objects'Libravatar Junio C Hamano1-6/+67
"pack-objects" learned to read large loose blobs using the streaming API, without the need to hold everything in core at once.
2012-06-28Merge branch 'nd/stream-index-pack'Libravatar Junio C Hamano1-23/+171
Use streaming API to read from the object store to avoid having to hold a large blob object in-core while running index-pack.
2012-06-28Merge branch 'mm/verify-filename-fix'Libravatar Junio C Hamano3-4/+4
"git diff COPYING HEAD:COPYING" gave a nonsense error message that claimed that the treeish HEAD did not have COPYING in it.
2012-06-28Merge branch 'jk/diff-no-index-pager'Libravatar Junio C Hamano1-7/+17
"git diff --no-index" did not work with pagers correctly.
2012-06-28Allow help.htmlpath to be a URL prefixLibravatar Chris Webb1-3/+5
Setting this to a URL prefix instead of a path to a local directory allows git-help --web to work even when HTML docs aren't locally installed, by pointing the browser at a copy accessible on the web. For example, [help] format = html htmlpath = http://git-scm.com/docs will use the publicly available documentation on the git homepage. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-28Add config variable to set HTML path for git-help --webLibravatar Chris Webb1-1/+10
If set in git-config, help.htmlpath overrides system_path(GIT_HTML_PATH) which was compiled in. This allows users to repoint system-wide git at their own copy of the documentation without recompiling. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-27fast-export: quote paths with spacesLibravatar Jay Soffian1-0/+2
A path containing a space must be quoted when used as an argument to either the copy or rename commands (because unlike other commands, the path is not the final thing on the line for those commands). Commit 6280dfdc3b (fast-export: quote paths in output, 2011-08-05) previously attempted to fix fast-export's quoting by passing all paths through quote_c_style(). However, that function does not consider the space to be a character which requires quoting, so let's special-case the space inside print_path(). This will cause space-containing paths to also be quoted in other commands where such quoting is not strictly necessary, but it does not hurt to do so. The test from 6280dfdc3b did not detect this because, while it does introduce renames in the export stream, it does not actually turn on rename detection, so they were presented as pairs of deletions/adds. Using "-M" reveals the bug. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-26index-pack: Disable threading on cygwinLibravatar Junio C Hamano1-2/+2
The Cygwin implementation of pread() is not thread-safe since, just like the emulation provided by compat/pread.c, it uses a sequence of seek-read-seek calls. In order to avoid failues due to thread-safety issues, commit b038a61 disables threading when NO_PREAD is defined. (ie when using the emulation code in compat/pread.c). We introduce a new build variable, NO_THREAD_SAFE_PREAD, which allows use to disable the threaded index-pack code on cygwin, in addition to the above NO_PREAD case. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-26git-checkout: disallow --detach on unborn branchLibravatar Chris Webb1-0/+2
abe199808c (git checkout -b: allow switching out of an unborn branch) introduced a bug demonstrated by git checkout --orphan foo git checkout --detach git symbolic-ref HEAD which gives 'refs/heads/(null)'. This happens because we strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch) when opts->new_branch can be NULL for --detach. Catch and forbid this case, adding a test to t2017 to catch it in future. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-25git credential fill: output the whole 'struct credential'Libravatar Matthieu Moy1-4/+1
Instead of outputing only the username and password, print all the attributes, even those that already appeared in the input. This is closer to what the C API does, and allows one to take the exact output of "git credential fill" as input to "git credential approve" or "git credential reject". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-25add 'git credential' plumbing commandLibravatar Javier Roucher Iglesias1-0/+34
The credential API is in C, and not available to scripting languages. Expose the functionalities of the API by wrapping them into a new plumbing command "git credentials". In other words, replace the internal "test-credential" by an official Git command. Most documentation writen by: Jeff King <peff@peff.net> Signed-off-by: Pavel Volek <Pavel.Volek@ensimag.imag.fr> Signed-off-by: Kim Thuat Nguyen <Kim-Thuat.Nguyen@ensimag.imag.fr> Signed-off-by: Javier Roucher Iglesias <Javier.Roucher-Iglesias@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-25Merge branch 'nd/i18n-misc'Libravatar Junio C Hamano1-2/+4
Restructure the way message strings are created, in preparation for marking them for i18n. * nd/i18n-misc: rerere: remove i18n legos in result message notes-merge: remove i18n legos in merge result message reflog: remove i18n legos in pruning message
2012-06-25config: write to $XDG_CONFIG_HOME/git/config file when appropriateLibravatar Huynh Khoi Nguyen Nguyen1-4/+1
Teach git to write to $XDG_CONFIG_HOME/git/config if - it already exists, - $HOME/.gitconfig file doesn't, and - The --global option is used. Otherwise, write to $HOME/.gitconfig when the --global option is given, as before. If the user doesn't create $XDG_CONFIG_HOME/git/config, there is absolutely no change. Users can use this new file only if they want. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/config will be used. Advice for users who often come back to an old version of Git: you shouldn't create this file. Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-25config: read (but not write) from $XDG_CONFIG_HOME/git/config fileLibravatar Huynh Khoi Nguyen Nguyen1-9/+19
Teach git to read the "gitconfig" information from a new location, $XDG_CONFIG_HOME/git/config; this allows the user to avoid cluttering $HOME with many per-application configuration files. In the order of reading, this file comes between the global configuration file (typically $HOME/.gitconfig) and the system wide configuration file (typically /etc/gitconfig). We do not write to this new location (yet). If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/config will be used. This is in line with XDG specification. If the new file does not exist, the behavior is unchanged. Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr> Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr> Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr> Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-22clone: fix ref selection in --single-branch --branch=xxxLibravatar Nguyễn Thái Ngọc Duy1-2/+5
- do not fetch HEAD - do not also fetch refs following "xxx" Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-22Merge branch 'vr/help-per-platform'Libravatar Junio C Hamano1-3/+3
* vr/help-per-platform: Restore use of 'help.format' configuration property in 'git help'
2012-06-22Restore use of 'help.format' configuration property in 'git help'Libravatar Pat Thoyts1-3/+3
Commit 1cc8af0 "help: use HTML as the default help format on Windows" lost the ability to make use of the help.format config value by forcing the use of a compiled in default if no command-line argument was provided. This commit restores the use of the help.format value if one is available, overriding the compiled default. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-21Merge branch 'vr/help-per-platform'Libravatar Junio C Hamano1-1/+7
We used to always default to "man" format even on platforms where "man" viewer is not widely available. * vr/help-per-platform: help: use HTML as the default help format on Windows
2012-06-21Merge branch 'jc/ls-files-i-dir'Libravatar Junio C Hamano2-7/+22
"git ls-files --exclude=t -i" did not consider anything under t/ as excluded, as it did not pay attention to exclusion of leading paths while walking the index. Other two users of excluded() are also updated. * jc/ls-files-i-dir: dir.c: make excluded() file scope static unpack-trees.c: use path_excluded() in check_ok_to_remove() builtin/add.c: use path_excluded() path_excluded(): update API to less cache-entry centric ls-files -i: micro-optimize path_excluded() ls-files -i: pay attention to exclusion of leading paths
2012-06-21Merge branch 'jk/version-string'Libravatar Junio C Hamano1-0/+1
Teaches git native protocol agents to show software version over the wire. * jk/version-string: http: get default user-agent from git_user_agent version: add git_user_agent function move git_version_string into version.c
2012-06-21Merge branch 'jk/clone-local'Libravatar Junio C Hamano1-5/+5
"git clone --local $path" started its life as an experiment to optionally use link/copy when cloning a repository on the disk, but we didn't deprecate it after we made the option a no-op to always use the optimization. The command learns "--no-local" option to turn this off, as a more explicit alternative over use of file:// URL. * jk/clone-local: clone: allow --no-local to turn off local optimizations docs/clone: mention that --local may be ignored
2012-06-18verify_filename(): ask the caller to chose the kind of diagnosisLibravatar Matthieu Moy3-4/+4
verify_filename() can be called in two different contexts. Either we just tried to interpret a string as an object name, and it fails, so we try looking for a working tree file (i.e. we finished looking at revs that come earlier on the command line, and the next argument must be a pathname), or we _know_ that we are looking for a pathname, and shouldn't even try interpreting the string as an object name. For example, with this change, we get: $ git log COPYING HEAD:inexistant fatal: HEAD:inexistant: no such path in the working tree. Use '-- <path>...' to specify paths that do not exist locally. $ git log HEAD:inexistant fatal: Path 'inexistant' does not exist in 'HEAD' Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-17Merge branch 'js/maint-fast-export-mark-error' into maintLibravatar Junio C Hamano1-1/+1
"git fast-export" did not give a readable error message when the same mark erroneously appeared twice in the --import-marks input.
2012-06-15fix pager.diff with diff --no-indexLibravatar Jeff King1-7/+17
git-diff does not rely on the git wrapper to setup its pager; instead, it sets it up on its own after seeing whether --quiet or --exit-code has been specified. After diff_no_index was split off from cmd_diff, commit b3fde6c (git diff --no-index: default to page like other diff frontends, 2008-05-26) duplicated the one-liner from cmd_diff to turn on the pager. Later, commit 8f0359f (Allow pager of diff command be enabled/disabled, 2008-07-21) taught the the version in cmd_diff to respect the pager.diff config, but the version in diff_no_index was left behind. This meant that git -c pager.diff=0 diff a b would not use a pager, but git -c pager.diff=0 diff --no-index a b would. Let's fix it by factoring out a common function. While we're there, let's update the antiquated comment, which claims that the pager interferes with propagating the exit code; this has not been the case since ea27a18 (spawn pager via run_command interface, 2008-07-22). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-12Merge branch 'jc/fmt-merge-msg-people'Libravatar Junio C Hamano1-2/+2
Tone down the lines that credit people involved and make them comments, so that integrators who edit their merge messages can still make use of the information, but lazy ones will not leave the unverified guesses placed on the "via" line. * jc/fmt-merge-msg-people: fmt-merge-msg: make attribution into comment lines
2012-06-12Merge branch 'js/maint-fast-export-mark-error'Libravatar Junio C Hamano1-1/+1
* js/maint-fast-export-mark-error: fast-export: report SHA-1 instead of gibberish when marks exist already
2012-06-11update-index: allow overwriting existing submodule index entriesLibravatar Heiko Voigt1-6/+0
In commit e01105 Linus introduced gitlinks to update-index. He explains that he thinks it is not the right thing to replace a gitlink with something else. That commit is from the very first beginnings of submodule support. Since then we have gotten a lot closer to being able to remove a submodule without losing its history. This check prevents such a use case, so I think this assumption has changed. Additionally in the git add codepath we do not have such a check, so for consistency reasons I think removing this check is the correct thing to do. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-07reflog: remove i18n legos in pruning messageLibravatar Nguyễn Thái Ngọc Duy1-2/+4
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-06fmt-merge-msg: make attribution into comment linesLibravatar Junio C Hamano1-2/+2
The submaintainer credit is not something you can compute purely by looking at the history and its shape, especially in the presense of fast-forward merges, and this observation makes the information on the "via" line unreliable. Let's leave the final determination of credits up to whoever is making the merge and show them as comments. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-06help: use HTML as the default help format on WindowsLibravatar Vincent van Ravesteijn1-1/+7
When 'git help $cmd' is run without a format option (e.g. -w), the 'man' format is always used. On some platforms, however, manual page viewers are not often available. Introduce DEFAULT_HELP_FORMAT make variable in order to allow the default format configurable at compile time, and set it to HTML when compiling on Windows (but not Cygwin). Helped-by: Jeff King <peff@peff.net> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-05builtin/add.c: use path_excluded()Libravatar Junio C Hamano1-1/+5
This only happens in --ignore-missing --dry-run codepath which presumably nobody should care, but is for completeness. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-05path_excluded(): update API to less cache-entry centricLibravatar Junio C Hamano1-2/+8
It was stupid of me to make the API too much cache-entry specific; the caller may want to check arbitrary pathname without having a corresponding cache-entry to see if a path is ignored. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-03ls-files -i: pay attention to exclusion of leading pathsLibravatar Junio C Hamano1-6/+11
"git ls-files --exclude=t/ -i" does not show paths in directory t/ that have been added to the index, but it should. The excluded() API was designed for callers who walk the tree from the top, checking each level of the directory hierarchy as it descends if it is excluded, and not even bothering to recurse into an excluded directory. This would allow us optimize for a common case by not having to check if the exclude pattern "foo/" matches when looking at "foo/bar", because the caller should have noticed that "foo" is excluded and did not even bother to read "foo/bar" out of opendir()/readdir() to call it. The code for "ls-files -i" however walks the index linearly, feeding paths without checking if the leading directory is already excluded. Introduce a helper function path_excluded() to let this caller properly call excluded() check for higher hierarchies as necessary. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-03move git_version_string into version.cLibravatar Jeff King1-0/+1
The global git_version_string currently lives in git.c, but doesn't have anything to do with the git wrapper. Let's move it into its own file, where it will be more appropriate to build more version-related functions. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-01Merge branch 'rs/maint-grep-F' into maintLibravatar Junio C Hamano1-5/+2
"git grep -e '$pattern'", unlike the case where the patterns are read from a file, did not treat individual lines in the given pattern argument as separate regular expressions as it should. By René Scharfe * rs/maint-grep-F: grep: stop leaking line strings with -f grep: support newline separated pattern list grep: factor out do_append_grep_pat() grep: factor out create_grep_pat()
2012-06-01Merge branch 'ap/checkout-no-progress-for-non-tty' into maintLibravatar Junio C Hamano1-2/+2
"git checkout" gave progress display even when the standard error stream was not connected to the tty, which made little sense. By Avery Pennarun * ap/checkout-no-progress-for-non-tty: checkout: no progress messages if !isatty(2).
2012-06-01i18n: apply: split to fix a partial i18n messageLibravatar Jiang Xin1-4/+12
The 4th arg of "new mode (%o) of %s does not match old mode (%o)%s%s" is blank string or string " of ". Even mark the string " of " for a complete i18n, this message is still hard to translate right. Split it into two slight different messages would make l10n teams happy. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-30clone: allow --no-local to turn off local optimizationsLibravatar Jeff King1-5/+5
This is basically the same as using "file://", but is a little less subtle for the end user. It also allows relative paths to be specified. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-29Merge branch 'jk/ident-gecos-strbuf'Libravatar Junio C Hamano6-47/+20
Fixes quite a lot of brokenness when ident information needs to be taken from the system and cleans up the code. By Jeff King * jk/ident-gecos-strbuf: (22 commits) format-patch: do not use bogus email addresses in message ids ident: reject bogus email addresses with IDENT_STRICT ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT format-patch: use GIT_COMMITTER_EMAIL in message ids ident: let callers omit name with fmt_indent ident: refactor NO_DATE flag in fmt_ident ident: reword empty ident error message format-patch: refactor get_patch_filename ident: trim whitespace from default name/email ident: use a dynamic strbuf in fmt_ident ident: use full dns names to generate email addresses ident: report passwd errors with a more friendly message drop length limitations on gecos-derived names and emails ident: don't write fallback username into git_default_name fmt_ident: drop IDENT_WARN_ON_NO_NAME code format-patch: use default email for generating message ids ident: trim trailing newline from /etc/mailname move git_default_* variables to ident.c move identity config parsing to ident.c fmt-merge-msg: don't use static buffer in record_person ...