OSDN Git Service
Jeff King [Thu, 9 Mar 2017 13:28:48 +0000 (08:28 -0500)]
ref-filter: use contains_result enum consistently
Commit
cbc60b672 (git tag --contains: avoid stack overflow,
2014-04-24) adapted the -1/0/1 contains status into a
tri-state enum. However, some of the code still used the
numeric values, or assumed that no/yes correspond to C's
boolean true/false.
Let's switch to using the symbolic values everywhere, which
will make it easier to change them.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Thu, 9 Mar 2017 13:27:55 +0000 (08:27 -0500)]
ref-filter: move ref_cbdata definition into ref-filter.c
This is an implementation detail of how filter_refs() works,
and does not need to be exposed to the outside world. This
will become more important in future patches as we add new
private data types to it.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Hiroshi Shirosaki [Mon, 6 Mar 2017 05:59:07 +0000 (14:59 +0900)]
git svn: fix authentication with 'branch'
Authentication fails with svn branch while svn rebase and
svn dcommit work fine without authentication failures.
$ git svn branch v7_3
Copying https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx at r27519
to https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/v7_3...
Can't create session: Unable to connect to a repository at URL
'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': No more
credentials or we tried too many times.
Authentication failed at
C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1200.
We add auth configuration to SVN::Client->new() to fix the issue.
Signed-off-by: Hiroshi Shirosaki <h.shirosaki@gmail.com>
Signed-off-by: Eric Wong <e@80x24.org>
Junio C Hamano [Mon, 27 Feb 2017 22:04:24 +0000 (14:04 -0800)]
First batch after 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)]
Merge branch 'rl/remote-allow-missing-branch-name-merge'
"git remote rm X", when a branch has remote X configured as the
value of its branch.*.remote, tried to remove branch.*.remote and
branch.*.merge and failed if either is unset.
* rl/remote-allow-missing-branch-name-merge:
remote: ignore failure to remove missing branch.<name>.merge
Junio C Hamano [Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)]
Merge branch 'km/delete-ref-reflog-message'
"git update-ref -d" and other operations to delete references did
not leave any entry in HEAD's reflog when the reference being
deleted was the current branch. This is not a problem in practice
because you do not want to delete the branch you are currently on,
but caused renaming of the current branch to something else not to
be logged in a useful way.
* km/delete-ref-reflog-message:
branch: record creation of renamed branch in HEAD's log
rename_ref: replace empty message in HEAD's log
update-ref: pass reflog message to delete_ref()
delete_ref: accept a reflog message argument
Junio C Hamano [Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)]
Merge branch 'jk/tempfile-ferror-fclose-confusion'
A caller of tempfile API that uses stdio interface to write to
files may ignore errors while writing, which is detected when
tempfile is closed (with a call to ferror()). By that time, the
original errno that may have told us what went wrong is likely to
be long gone and was overwritten by an irrelevant value.
close_tempfile() now resets errno to EIO to make errno at least
predictable.
* jk/tempfile-ferror-fclose-confusion:
tempfile: set errno to a known value before calling ferror()
Junio C Hamano [Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)]
Merge branch 'vn/xdiff-func-context'
"git diff -W" has been taught to handle the case where a new
function is added at the end of the file better.
* vn/xdiff-func-context:
xdiff -W: relax end-of-file function detection
Junio C Hamano [Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)]
Merge branch 'js/git-path-in-subdir'
The "--git-path", "--git-common-dir", and "--shared-index-path"
options of "git rev-parse" did not produce usable output. They are
now updated to show the path to the correct file, relative to where
the caller is.
* js/git-path-in-subdir:
rev-parse: fix several options when running in a subdirectory
rev-parse tests: add tests executed from a subdirectory
Junio C Hamano [Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)]
Merge branch 'mm/two-more-xstrfmt'
Code clean-up and a string truncation fix.
* mm/two-more-xstrfmt:
bisect_next_all: convert xsnprintf to xstrfmt
stop_progress_msg: convert xsnprintf to xstrfmt
Junio C Hamano [Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)]
Merge branch 'nd/clean-preserve-errno-in-warning'
Some warning() messages from "git clean" were updated to show the
errno from failed system calls.
* nd/clean-preserve-errno-in-warning:
clean: use warning_errno() when appropriate
Junio C Hamano [Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)]
Merge branch 'jk/show-branch-lift-name-len-limit'
"git show-branch" expected there were only very short branch names
in the repository and used a fixed-length buffer to hold them
without checking for overflow.
* jk/show-branch-lift-name-len-limit:
show-branch: use skip_prefix to drop magic numbers
show-branch: store resolved head in heap buffer
show-branch: drop head_len variable
Junio C Hamano [Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)]
Merge branch 'jn/remote-helpers-with-git-dir'
"git ls-remote" and "git archive --remote" are designed to work
without being in a directory under Git's control. However, recent
updates revealed that we randomly look into a directory called
.git/ without actually doing necessary set-up when working in a
repository. Stop doing so.
* jn/remote-helpers-with-git-dir:
remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
remote: avoid reading $GIT_DIR config in non-repo
Junio C Hamano [Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)]
Merge branch 'jk/grep-no-index-fix'
The code to parse the command line "git grep <patterns>... <rev>
[[--] <pathspec>...]" has been cleaned up, and a handful of bugs
have been fixed (e.g. we used to check "--" if it is a rev).
* jk/grep-no-index-fix:
grep: treat revs the same for --untracked as for --no-index
grep: do not diagnose misspelt revs with --no-index
grep: avoid resolving revision names in --no-index case
grep: fix "--" rev/pathspec disambiguation
grep: re-order rev-parsing loop
grep: do not unnecessarily query repo for "--"
grep: move thread initialization a little lower
Junio C Hamano [Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)]
Merge branch 'dt/gc-ignore-old-gc-logs'
A "gc.log" file left by a backgrounded "gc --auto" disables further
automatic gc; it has been taught to run at least once a day (by
default) by ignoring a stale "gc.log" file that is too old.
* dt/gc-ignore-old-gc-logs:
gc: ignore old gc.log files
Junio C Hamano [Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)]
Merge branch 'jh/preload-index-skip-skip'
The preload-index code has been taught not to bother with the index
entries that are paths that are not checked out by "sparse checkout".
* jh/preload-index-skip-skip:
preload-index: avoid lstat for skip-worktree items
Junio C Hamano [Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)]
Merge branch 'mh/submodule-hash'
Code and design clean-up for the refs API.
* mh/submodule-hash:
read_loose_refs(): read refs using resolve_ref_recursively()
files_ref_store::submodule: use NULL for the main repository
base_ref_store_init(): remove submodule argument
refs: push the submodule attribute down
refs: store submodule ref stores in a hashmap
register_ref_store(): new function
refs: remove some unnecessary handling of submodule == ""
refs: make some ref_store lookup functions private
refs: reorder some function definitions
Junio C Hamano [Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)]
Merge branch 'sf/putty-w-args'
The command line options for ssh invocation needs to be tweaked for
some implementations of SSH (e.g. PuTTY plink wants "-P <port>"
while OpenSSH wants "-p <port>" to specify port to connect to), and
the variant was guessed when GIT_SSH environment variable is used
to specify it. The logic to guess now applies to the command
specified by the newer GIT_SSH_COMMAND and also core.sshcommand
configuration variable, and comes with an escape hatch for users to
deal with misdetected cases.
* sf/putty-w-args:
connect.c: stop conflating ssh command names and overrides
connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
git_connect(): factor out SSH variant handling
connect: rename tortoiseplink and putty variables
connect: handle putty/plink also in GIT_SSH_COMMAND
Junio C Hamano [Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)]
Merge branch 'js/rebase-helper'
"git rebase -i" starts using the recently updated "sequencer" code.
* js/rebase-helper:
rebase -i: use the rebase--helper builtin
rebase--helper: add a builtin helper for interactive rebases
Junio C Hamano [Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)]
Merge branch 'bw/attr'
The gitattributes machinery is being taught to work better in a
multi-threaded environment.
* bw/attr: (27 commits)
attr: reformat git_attr_set_direction() function
attr: push the bare repo check into read_attr()
attr: store attribute stack in attr_check structure
attr: tighten const correctness with git_attr and match_attr
attr: remove maybe-real, maybe-macro from git_attr
attr: eliminate global check_all_attr array
attr: use hashmap for attribute dictionary
attr: change validity check for attribute names to use positive logic
attr: pass struct attr_check to collect_some_attrs
attr: retire git_check_attrs() API
attr: convert git_check_attrs() callers to use the new API
attr: convert git_all_attrs() to use "struct attr_check"
attr: (re)introduce git_check_attr() and struct attr_check
attr: rename function and struct related to checking attributes
attr.c: outline the future plans by heavily commenting
Documentation: fix a typo
attr.c: add push_stack() helper
attr: support quoting pathname patterns in C style
attr.c: plug small leak in parse_attr_line()
attr.c: tighten constness around "git_attr" structure
...
Junio C Hamano [Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)]
Merge branch 'sg/completion'
Clean-up and updates to command line completion (in contrib/).
* sg/completion: (22 commits)
completion: restore removed line continuating backslash
completion: cache the path to the repository
completion: extract repository discovery from __gitdir()
completion: don't guard git executions with __gitdir()
completion: consolidate silencing errors from git commands
completion: don't use __gitdir() for git commands
completion: respect 'git -C <path>'
rev-parse: add '--absolute-git-dir' option
completion: fix completion after 'git -C <path>'
completion: don't offer commands when 'git --opt' needs an argument
completion: list short refs from a remote given as a URL
completion: don't list 'HEAD' when trying refs completion outside of a repo
completion: list refs from remote when remote's name matches a directory
completion: respect 'git --git-dir=<path>' when listing remote refs
completion: fix most spots not respecting 'git --git-dir=<path>'
completion: ensure that the repository path given on the command line exists
completion tests: add tests for the __git_refs() helper function
completion tests: check __gitdir()'s output in the error cases
completion tests: consolidate getting path of current working directory
completion tests: make the $cur variable local to the test helper functions
...
Junio C Hamano [Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)]
Merge branch 'lt/pathspec-negative'
The "negative" pathspec feature was somewhat more cumbersome to use
than necessary in that its short-hand used "!" which needed to be
escaped from shells, and it required "exclude from what?" specified.
* lt/pathspec-negative:
pathspec: don't error out on all-exclusionary pathspec patterns
pathspec magic: add '^' as alias for '!'
Junio C Hamano [Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)]
Merge branch 'cw/tag-reflog-message'
"git tag" did not leave useful message when adding a new entry to
reflog; this was left unnoticed for a long time because refs/tags/*
doesn't keep reflog by default.
* cw/tag-reflog-message:
tag: generate useful reflog message
Junio C Hamano [Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)]
Merge branch 'jk/alternate-ref-optim'
Optimizes resource usage while enumerating refs from alternate
object store, to help receiving end of "push" that hosts a
repository with many "forks".
* jk/alternate-ref-optim:
receive-pack: avoid duplicates between our refs and alternates
receive-pack: treat namespace .have lines like alternates
receive-pack: fix misleading namespace/.have comment
receive-pack: use oidset to de-duplicate .have lines
add oidset API
fetch-pack: cache results of for_each_alternate_ref
for_each_alternate_ref: replace transport code with for-each-ref
for_each_alternate_ref: pass name/oid instead of ref struct
for_each_alternate_ref: use strbuf for path allocation
for_each_alternate_ref: stop trimming trailing slashes
for_each_alternate_ref: handle failure from real_pathdup()
Junio C Hamano [Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)]
Merge branch 'kn/ref-filter-branch-list'
The code to list branches in "git branch" has been consolidated
with the more generic ref-filter API.
* kn/ref-filter-branch-list: (21 commits)
ref-filter: resurrect "strip" as a synonym to "lstrip"
branch: implement '--format' option
branch: use ref-filter printing APIs
branch, tag: use porcelain output
ref-filter: allow porcelain to translate messages in the output
ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
ref-filter: Do not abruptly die when using the 'lstrip=<N>' option
ref-filter: rename the 'strip' option to 'lstrip'
ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
ref-filter: introduce refname_atom_parser()
ref-filter: introduce refname_atom_parser_internal()
ref-filter: make "%(symref)" atom work with the ':short' modifier
ref-filter: add support for %(upstream:track,nobracket)
ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
ref-filter: introduce format_ref_array_item()
ref-filter: move get_head_description() from branch.c
ref-filter: modify "%(objectname:short)" to take length
ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
ref-filter: include reference to 'used_atom' within 'atom_value'
...
Junio C Hamano [Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)]
Merge branch 'ps/urlmatch-wildcard'
The <url> part in "http.<url>.<variable>" configuration variable
can now be spelled with '*' that serves as wildcard.
E.g. "http.https://*.example.com.proxy" can be used to specify the
proxy used for https://a.example.com, https://b.example.com, etc.,
i.e. any host in the example.com domain.
* ps/urlmatch-wildcard:
urlmatch: allow globbing for the URL host part
urlmatch: include host in urlmatch ranking
urlmatch: split host and port fields in `struct url_info`
urlmatch: enable normalization of URLs with globs
mailmap: add Patrick Steinhardt's work address
Junio C Hamano [Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)]
Merge branch 'mm/merge-rename-delete-message'
When "git merge" detects a path that is renamed in one history
while the other history deleted (or modified) it, it now reports
both paths to help the user understand what is going on in the two
histories being merged.
* mm/merge-rename-delete-message:
merge-recursive: make "CONFLICT (rename/delete)" message show both paths
Junio C Hamano [Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)]
Merge branch 'mh/ref-remove-empty-directory'
Deletion of a branch "foo/bar" could remove .git/refs/heads/foo
once there no longer is any other branch whose name begins with
"foo/", but we didn't do so so far. Now we do.
* mh/ref-remove-empty-directory: (23 commits)
files_transaction_commit(): clean up empty directories
try_remove_empty_parents(): teach to remove parents of reflogs, too
try_remove_empty_parents(): don't trash argument contents
try_remove_empty_parents(): rename parameter "name" -> "refname"
delete_ref_loose(): inline function
delete_ref_loose(): derive loose reference path from lock
log_ref_write_1(): inline function
log_ref_setup(): manage the name of the reflog file internally
log_ref_write_1(): don't depend on logfile argument
log_ref_setup(): pass the open file descriptor back to the caller
log_ref_setup(): improve robustness against races
log_ref_setup(): separate code for create vs non-create
log_ref_write(): inline function
rename_tmp_log(): improve error reporting
rename_tmp_log(): use raceproof_create_file()
lock_ref_sha1_basic(): use raceproof_create_file()
lock_ref_sha1_basic(): inline constant
raceproof_create_file(): new function
safe_create_leading_directories(): set errno on SCLD_EXISTS
safe_create_leading_directories_const(): preserve errno
...
Junio C Hamano [Mon, 27 Feb 2017 21:57:11 +0000 (13:57 -0800)]
Merge branch 'jk/delta-chain-limit'
"git repack --depth=<n>" for a long time busted the specified depth
when reusing delta from existing packs. This has been corrected.
* jk/delta-chain-limit:
pack-objects: convert recursion to iteration in break_delta_chain()
pack-objects: enforce --depth limit in reused deltas
Junio C Hamano [Mon, 27 Feb 2017 21:57:11 +0000 (13:57 -0800)]
Merge branch 'jk/describe-omit-some-refs'
"git describe" and "git name-rev" have been taught to take more
than one refname patterns to restrict the set of refs to base their
naming output on, and also learned to take negative patterns to
name refs not to be used for naming via their "--exclude" option.
* jk/describe-omit-some-refs:
describe: teach describe negative pattern matches
describe: teach --match to accept multiple patterns
name-rev: add support to exclude refs by pattern match
name-rev: extend --refs to accept multiple patterns
doc: add documentation for OPT_STRING_LIST
Junio C Hamano [Fri, 24 Feb 2017 18:49:58 +0000 (10:49 -0800)]
Git 2.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 24 Feb 2017 18:48:10 +0000 (10:48 -0800)]
Merge branch 'ps/doc-gc-aggressive-depth-update'
Doc update.
* ps/doc-gc-aggressive-depth-update:
docs/git-gc: fix default value for `--aggressiveDepth`
Junio C Hamano [Fri, 24 Feb 2017 18:48:10 +0000 (10:48 -0800)]
Merge branch 'bc/worktree-doc-fix-detached'
Doc update.
* bc/worktree-doc-fix-detached:
Documentation: correctly spell git worktree --detach
Junio C Hamano [Fri, 24 Feb 2017 18:48:09 +0000 (10:48 -0800)]
Merge branch 'dr/doc-check-ref-format-normalize'
Doc update.
* dr/doc-check-ref-format-normalize:
git-check-ref-format: clarify documentation for --normalize
Junio C Hamano [Fri, 24 Feb 2017 18:48:09 +0000 (10:48 -0800)]
Merge branch 'gp/document-dotfiles-in-templates-are-not-copied'
Doc update.
* gp/document-dotfiles-in-templates-are-not-copied:
init: document dotfiles exclusion on template copy
Junio C Hamano [Fri, 24 Feb 2017 18:48:08 +0000 (10:48 -0800)]
Merge branch 'rt/align-add-i-help-text'
Doc update.
* rt/align-add-i-help-text:
git add -i: replace \t with blanks in the help message
Junio C Hamano [Fri, 24 Feb 2017 18:48:07 +0000 (10:48 -0800)]
Merge branch 'bc/blame-doc-fix'
Doc update.
* bc/blame-doc-fix:
Documentation: use brackets for optional arguments
Patrick Steinhardt [Fri, 24 Feb 2017 08:46:45 +0000 (09:46 +0100)]
docs/git-gc: fix default value for `--aggressiveDepth`
In commit
07e7dbf0d (gc: default aggressive depth to 50, 2016-08-11),
the default aggressive depth of git-gc has been changed to 50. While
git-config(1) has been updated to represent the new default value,
git-gc(1) still mentions the old value. This patch fixes it.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 24 Feb 2017 17:55:41 +0000 (09:55 -0800)]
Merge tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po
l10n-2.12.0-rnd2
* tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
l10n: zh_CN: for git v2.12.0 l10n round 2
l10n: Update Catalan translation
l10n: pt_PT: update Portuguese tranlation
l10n: sv.po: Update Swedish translation (3139t0f0u)
l10n: de.po: translate 241 messages
l10n: ko.po: Update Korean translation
l10n: vi.po (3139t): Updated 2 new messages for rc1
l10n: fr.po: v2.12.0 round 2 3139t
l10n: git.pot: v2.12.0 round 2 (2 new)
l10n: vi.po: Updated Vietnamese translation (3137t)
l10n: update Catalan translation
l10n: sv.po: Update Swedish translation (3137t0f0u)
l10n: fr.po: v2.11-rc0 first round
l10n: ko.po: Update Korean translation
l10n: fr.po: Fix a typo in the French translation
l10n: fr.po: Remove gender specific adjectives
l10n: fr.po: Fix typos
l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
l10n: fixes to Catalan translation
...
Jiang Xin [Fri, 27 Jan 2017 14:50:57 +0000 (22:50 +0800)]
l10n: zh_CN: for git v2.12.0 l10n round 2
Translate 241 messages (3139t0f0u) for git v2.12.0-rc1.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Jordi Mas [Tue, 21 Feb 2017 17:32:29 +0000 (18:32 +0100)]
l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
Vasco Almeida [Sun, 5 Feb 2017 18:43:34 +0000 (17:43 -0100)]
l10n: pt_PT: update Portuguese tranlation
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Ralf Thielow [Wed, 22 Feb 2017 18:46:27 +0000 (19:46 +0100)]
git add -i: replace \t with blanks in the help message
Within the help message of 'git add -i', the 'diff' command uses one
tab character and blanks to create the space between the name and the
description while the others use blanks only. So if the tab size is
not at 4 characters, this description will not be in range.
Replace the tab character with blanks.
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson [Wed, 22 Feb 2017 12:25:46 +0000 (12:25 +0000)]
Documentation: use brackets for optional arguments
The documentation for git blame used vertical bars for optional
arguments to -M and -C, which is unusual and potentially confusing.
Since most man pages use brackets for optional items, and that's
consistent with how we document the same options for git diff and
friends, use brackets here, too.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson [Wed, 22 Feb 2017 12:34:42 +0000 (12:34 +0000)]
Documentation: correctly spell git worktree --detach
The option is “--detach”, but we accidentally spelled it “--detached” at
one point in the man page.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Reported-by: Casey Rodarmor <casey@rodarmor.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ross Lagerwall [Sat, 18 Feb 2017 00:23:41 +0000 (00:23 +0000)]
remote: ignore failure to remove missing branch.<name>.merge
It is not all too unusual for a branch to use "branch.<name>.remote"
without "branch.<name>.merge". You may be using the 'push.default'
configuration set to 'current', for example, and do
$ git checkout -b side colleague/side
$ git config branch.side.remote colleague
However, "git remote rm" to remove the remote used in such a manner
fails with
"fatal: could not unset 'branch.<name>.merge'"
because it assumes that a branch that has .remote defined must also
have .merge defined. Detect the "cannot unset because it is not set
to begin with" case and ignore it.
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Damien Regad [Sun, 19 Feb 2017 22:32:32 +0000 (23:32 +0100)]
git-check-ref-format: clarify documentation for --normalize
Use of 'iff' may be confusing to people not familiar with this term.
Improving the --normalize option's documentation to remove the use of
'iff', and clearly describe what happens when the condition is not met.
Signed-off-by: Damien Regad <dregad@mantisbt.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jiang Xin [Tue, 21 Feb 2017 16:06:44 +0000 (00:06 +0800)]
Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
* 'master' of git://github.com/nafmo/git-l10n-sv:
l10n: sv.po: Update Swedish translation (3139t0f0u)
Kyle Meyer [Tue, 21 Feb 2017 01:10:35 +0000 (20:10 -0500)]
branch: record creation of renamed branch in HEAD's log
Renaming the current branch adds an event to the current branch's log
and to HEAD's log. However, the logged entries differ. The entry in
the branch's log represents the entire renaming operation (the old and
new hash are identical), whereas the entry in HEAD's log represents
the deletion only (the new sha1 is null).
Extend replace_each_worktree_head_symref(), whose only caller is
branch_rename(), to take a reflog message argument. This allows the
creation of the new ref to be recorded in HEAD's log. As a result,
the renaming event is represented by two entries (a deletion and a
creation entry) in HEAD's log.
It's a bit unfortunate that the branch's log and HEAD's log now
represent the renaming event in different ways. Given that the
renaming operation is not atomic, the two-entry form is a more
accurate representation of the operation and is more useful for
debugging purposes if a failure occurs between the deletion and
creation events. It would make sense to move the branch's log to the
two-entry form, but this would involve changes to how the rename is
carried out and to how the update flags and reflogs are processed for
deletions, so it may not be worth the effort.
Based-on-patch-by: Jeff King <peff@peff.net>
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Feb 2017 01:10:34 +0000 (20:10 -0500)]
rename_ref: replace empty message in HEAD's log
When the current branch is renamed, the deletion of the old ref is
recorded in HEAD's log with an empty message. Now that delete_ref()
accepts a reflog message, provide a more descriptive message by
passing along the log message that is given to rename_ref().
The next step will be to extend HEAD's log to also include the second
part of the rename, the creation of the new branch.
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Feb 2017 01:10:33 +0000 (20:10 -0500)]
update-ref: pass reflog message to delete_ref()
Now that delete_ref() accepts a reflog message, pass the user-provided
message to delete_ref() rather than silently dropping it.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Kyle Meyer [Tue, 21 Feb 2017 01:10:32 +0000 (20:10 -0500)]
delete_ref: accept a reflog message argument
When the current branch is renamed with 'git branch -m/-M' or deleted
with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log
with an empty message. In preparation for adding a more meaningful
message to HEAD's log in these cases, update delete_ref() to take a
message argument and pass it along to ref_transaction_delete().
Modify all callers to pass NULL for the new message argument; no
change in behavior is intended.
Note that this is relevant for HEAD's log but not for the deleted
ref's log, which is currently deleted along with the ref. Even if it
were not, an entry for the deletion wouldn't be present in the deleted
ref's log. files_transaction_commit() writes to the log if
REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update()
doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING
is set. In contrast, the update for HEAD has REF_LOG_ONLY set by
split_head_update(), resulting in the deletion being logged.
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 21 Feb 2017 06:01:59 +0000 (22:01 -0800)]
Merge branch 'svn-escape-backslash' of git://bogomips.org/git-svn
* 'svn-escape-backslash' of git://bogomips.org/git-svn:
git-svn: escape backslashes in refnames
Peter Krefting [Mon, 20 Feb 2017 18:40:11 +0000 (19:40 +0100)]
l10n: sv.po: Update Swedish translation (3139t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
Ralf Thielow [Mon, 20 Feb 2017 17:40:36 +0000 (18:40 +0100)]
l10n: de.po: translate 241 messages
Translate 241 messages came from git.pot update in
673bfad09
(l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)) and
a4d94835a
(l10n: git.pot: v2.12.0 round 2 (2 new)).
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>
Jiang Xin [Sun, 19 Feb 2017 14:08:05 +0000 (22:08 +0800)]
Merge branch 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko
* 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko:
l10n: ko.po: Update Korean translation
Jiang Xin [Sun, 19 Feb 2017 14:04:41 +0000 (22:04 +0800)]
Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
l10n: vi.po (3139t): Updated 2 new messages for rc1
Changwoo Ryu [Sun, 19 Feb 2017 10:34:24 +0000 (19:34 +0900)]
l10n: ko.po: Update Korean translation
Signed-off-by: Changwoo Ryu <cwryu@debian.org>
Tran Ngoc Quan [Sat, 18 Feb 2017 00:18:54 +0000 (07:18 +0700)]
l10n: vi.po (3139t): Updated 2 new messages for rc1
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
Grégoire Paris [Fri, 17 Feb 2017 23:37:00 +0000 (00:37 +0100)]
init: document dotfiles exclusion on template copy
Not just . and .., but any path that begins with dot is not copied
when copying the template directory to a new repository. You can
customize the template directory, copying some dotfiles might make
sense, but it's actually a good thing not to, because you would not
want to have your git directory copied in every git directory that
is created should you decide to put your template directory under
version control, for example. Plus, it might be used as a feature
by people who would want to exclude some files.
Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jean-Noel Avila [Fri, 17 Feb 2017 23:10:04 +0000 (00:10 +0100)]
l10n: fr.po: v2.12.0 round 2 3139t
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
Jeff King [Fri, 17 Feb 2017 21:07:49 +0000 (16:07 -0500)]
tempfile: set errno to a known value before calling ferror()
In close_tempfile(), we return an error if ferror()
indicated a previous failure, or if fclose() failed. In the
latter case, errno is set and it is useful for callers to
report it.
However, if _only_ ferror() triggers, then the value of
errno is based on whatever syscall happened to last fail,
which may not be related to our filehandle at all. A caller
cannot tell the difference between the two cases, and may
use "die_errno()" or similar to report a nonsense errno value.
One solution would be to actually pass back separate return
values for the two cases, so a caller can write a more
appropriate message for each case. But that makes the
interface clunky.
Instead, let's just set errno to the generic EIO in this case.
That's not as descriptive as we'd like, but at least it's
predictable. So it's better than the status quo in all cases
but one: when the last syscall really did involve a failure
on our filehandle, we'll be wiping that out. But that's a
fragile thing for us to rely on.
In any case, we'll let the errno result from fclose() take
precedence over our value, as we know that's recent and
accurate (and many I/O errors will persist through the
fclose anyway).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 17 Feb 2017 22:00:19 +0000 (14:00 -0800)]
Git 2.12-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Fri, 17 Feb 2017 16:59:06 +0000 (17:59 +0100)]
rev-parse: fix several options when running in a subdirectory
In addition to making git_path() aware of certain file names that need
to be handled differently e.g. when running in worktrees, the commit
557bd833bb (git_path(): be aware of file relocation in $GIT_DIR,
2014-11-30) also snuck in a new option for `git rev-parse`:
`--git-path`.
On the face of it, there is no obvious bug in that commit's diff: it
faithfully calls git_path() on the argument and prints it out, i.e. `git
rev-parse --git-path <filename>` has the same precise behavior as
calling `git_path("<filename>")` in C.
The problem lies deeper, much deeper. In hindsight (which is always
unfair), implementing the .git/ directory discovery in
`setup_git_directory()` by changing the working directory may have
allowed us to avoid passing around a struct that contains information
about the current repository, but it bought us many, many problems.
In this case, when being called in a subdirectory, `git rev-parse`
changes the working directory to the top-level directory before calling
`git_path()`. In the new working directory, the result is correct. But
in the working directory of the calling script, it is incorrect.
Example: when calling `git rev-parse --git-path HEAD` in, say, the
Documentation/ subdirectory of Git's own source code, the string
`.git/HEAD` is printed.
Side note: that bug is hidden when running in a subdirectory of a
worktree that was added by the `git worktree` command: in that case, the
(correct) absolute path of the `HEAD` file is printed.
In the interest of time, this patch does not go the "correct" route to
introduce a struct with repository information (and removing global
state in the process), instead this patch chooses to detect when the
command was called in a subdirectory and forces the result to be an
absolute path.
While at it, we are also fixing the output of --git-common-dir and
--shared-index-path.
Lastly, please note that we reuse the same strbuf for all of the
relative_path() calls; this avoids frequent allocation (and duplicated
code), and it does not risk memory leaks, for two reasons: 1) the
cmd_rev_parse() function does not return anywhere between the use of
the new strbuf instance and its final release, and 2) git-rev-parse is
one of these "one-shot" programs in Git, i.e. it exits after running
for a very short time, meaning that all allocated memory is released
with the exit() call anyway.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Rappazzo [Fri, 17 Feb 2017 16:59:02 +0000 (17:59 +0100)]
rev-parse tests: add tests executed from a subdirectory
t2027-worktree-list has an incorrect expectation for --git-common-dir
which has been adjusted and marked to expect failure.
Some of the tests added have been marked to expect failure. These
demonstrate a problem with the way that some options to git rev-parse
behave when executed from a subdirectory of the main worktree.
[jes: fixed incorrect assumption that objects/ lives in the
worktree-specific git-dir (it lives in the common dir instead). Also
adjusted t1700 so that the test case does not *need* to be the last
one in that script.]
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jiang Xin [Fri, 17 Feb 2017 17:00:54 +0000 (01:00 +0800)]
l10n: git.pot: v2.12.0 round 2 (2 new)
Generate po/git.pot from v2.12.0-rc1 for git v2.12.0 l10n round 2.
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Jiang Xin [Fri, 17 Feb 2017 16:59:51 +0000 (00:59 +0800)]
Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
l10n: vi.po: Updated Vietnamese translation (3137t)
l10n: update Catalan translation
l10n: sv.po: Update Swedish translation (3137t0f0u)
l10n: fr.po: v2.11-rc0 first round
l10n: ko.po: Update Korean translation
l10n: fr.po: Fix a typo in the French translation
l10n: fr.po: Remove gender specific adjectives
l10n: fr.po: Fix typos
l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
l10n: fixes to Catalan translation
l10n: zh_CN: review for git v2.11.0 l10n
l10n: New Catalan translation maintainer
Jiang Xin [Fri, 17 Feb 2017 16:54:49 +0000 (00:54 +0800)]
Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
l10n: vi.po: Updated Vietnamese translation (3137t)
Jiang Xin [Fri, 17 Feb 2017 16:49:06 +0000 (00:49 +0800)]
Merge branch 'master' of https://github.com/Softcatala/git-po
* 'master' of https://github.com/Softcatala/git-po:
l10n: update Catalan translation
Tran Ngoc Quan [Fri, 17 Feb 2017 06:51:34 +0000 (13:51 +0700)]
l10n: vi.po: Updated Vietnamese translation (3137t)
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
Junio C Hamano [Thu, 16 Feb 2017 22:46:35 +0000 (14:46 -0800)]
Hopefully the final batch of mini-topics before the final
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 16 Feb 2017 22:45:15 +0000 (14:45 -0800)]
Merge branch 'jk/tempfile-ferror-fclose-confusion'
Code clean-up.
* jk/tempfile-ferror-fclose-confusion:
tempfile: avoid "ferror | fclose" trick
Junio C Hamano [Thu, 16 Feb 2017 22:45:15 +0000 (14:45 -0800)]
Merge branch 'dp/submodule-doc-markup-fix'
Doc fix.
* dp/submodule-doc-markup-fix:
config.txt: fix formatting of submodule.alternateErrorStrategy section
Junio C Hamano [Thu, 16 Feb 2017 22:45:14 +0000 (14:45 -0800)]
Merge branch 'jk/reset-to-break-a-commit-doc-updated'
Doc update.
* jk/reset-to-break-a-commit-doc-updated:
reset: add an example of how to split a commit into two
Junio C Hamano [Thu, 16 Feb 2017 22:45:14 +0000 (14:45 -0800)]
Merge branch 'jk/reset-to-break-a-commit-doc'
Doc update.
* jk/reset-to-break-a-commit-doc:
Revert "reset: add an example of how to split a commit into two"
Junio C Hamano [Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)]
Merge branch 'js/mingw-isatty'
A hotfix for a topic already in 'master'.
* js/mingw-isatty:
mingw: make stderr unbuffered again
Junio C Hamano [Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)]
Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'
Code clean-up.
* rs/strbuf-cleanup-in-rmdir-recursively:
rm: reuse strbuf for all remove_dir_recursively() calls, again
Junio C Hamano [Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)]
Merge branch 'rs/ls-files-partial-optim'
"ls-files" run with pathspec has been micro-optimized to avoid
having to memmove(3) unnecessary bytes.
* rs/ls-files-partial-optim:
ls-files: move only kept cache entries in prune_cache()
ls-files: pass prefix length explicitly to prune_cache()
Junio C Hamano [Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)]
Merge branch 'rs/cocci-check-free-only-null'
A new coccinelle rule that catches a check of !pointer before the
pointer is free(3)d, which most likely is a bug.
* rs/cocci-check-free-only-null:
cocci: detect useless free(3) calls
Junio C Hamano [Thu, 16 Feb 2017 22:45:12 +0000 (14:45 -0800)]
Merge branch 'ls/p4-path-encoding'
When "git p4" imports changelist that removes paths, it failed to
convert pathnames when the p4 used encoding different from the one
used on the Git side. This has been corrected.
* ls/p4-path-encoding:
git-p4: fix git-p4.pathEncoding for removed files
Jeff King [Thu, 16 Feb 2017 21:31:40 +0000 (16:31 -0500)]
tempfile: avoid "ferror | fclose" trick
The current code wants to record an error condition from
either ferror() or fclose(), but makes sure that we always
call both functions. So it can't use logical-OR "||", which
would short-circuit when ferror() is true. Instead, it uses
bitwise-OR "|" to evaluate both functions and set one or
more bits in the "err" flag if they reported a failure.
Unlike logical-OR, though, bitwise-OR does not introduce a
sequence point, and the order of evaluation for its operands
is unspecified. So a compiler would be free to generate code
which calls fclose() first, and then ferror() on the
now-freed filehandle.
There's no indication that this has happened in practice,
but let's write it out in a way that follows the standard.
Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Pursehouse [Thu, 16 Feb 2017 05:05:35 +0000 (14:05 +0900)]
config.txt: fix formatting of submodule.alternateErrorStrategy section
Add missing `::` after the title.
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Tue, 14 Feb 2017 09:54:49 +0000 (16:54 +0700)]
clean: use warning_errno() when appropriate
All these warning() calls are preceded by a system call. Report the
actual error to help the user understand why we fail to remove
something.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jacob Keller [Thu, 16 Feb 2017 00:22:12 +0000 (16:22 -0800)]
reset: add an example of how to split a commit into two
It is often useful to break a commit into multiple parts that are more
logical separations. This can be tricky to learn how to do without the
brute-force method if re-writing code or commit messages from scratch.
Add a section to the git-reset documentation which shows an example
process for how to use git add -p and git commit -c HEAD@{1} to
interactively break a commit apart and re-use the original commit
message as a starting point when making the new commit message.
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 16 Feb 2017 21:35:50 +0000 (13:35 -0800)]
Revert "reset: add an example of how to split a commit into two"
This reverts commit
7326451bedaa67d29afe02184b166e28d9393c91; a
better rewrite will be queued separately.
Maxim Moseychuk [Thu, 16 Feb 2017 17:07:12 +0000 (20:07 +0300)]
bisect_next_all: convert xsnprintf to xstrfmt
Git can't run bisect between 2048+ commits if use russian
translation, because the translated string is too long for the fixed
buffer it uses (this can be reproduced "LANG=ru_RU.UTF8 git bisect
start v4.9 v4.8" on linux sources).
Use xstrfmt() to format the message string to sufficiently sized
buffer instead to fix this.
Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Maxim Moseychuk [Thu, 16 Feb 2017 17:07:13 +0000 (20:07 +0300)]
stop_progress_msg: convert xsnprintf to xstrfmt
Simplify code by replacing buffer allocation with a call to xstrfmt().
Signed-off-by: Maxim Moseychuk <franchesko.salias.hudro.pedros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jordi Mas [Thu, 16 Feb 2017 04:10:04 +0000 (05:10 +0100)]
l10n: update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
Junio C Hamano [Wed, 15 Feb 2017 22:58:25 +0000 (14:58 -0800)]
A bit more for -rc2
Junio C Hamano [Wed, 15 Feb 2017 22:56:41 +0000 (14:56 -0800)]
Merge branch 'tg/stash-doc-cleanup'
The documentation explained what "git stash" does to the working
tree (after stashing away the local changes) in terms of "reset
--hard", which was exposing an unnecessary implementation detail.
* tg/stash-doc-cleanup:
Documentation/stash: remove mention of git reset --hard
Junio C Hamano [Wed, 15 Feb 2017 22:56:40 +0000 (14:56 -0800)]
Merge branch 'jk/doc-submodule-markup-fix'
Doc markup fix.
* jk/doc-submodule-markup-fix:
docs/git-submodule: fix unbalanced quote
Junio C Hamano [Wed, 15 Feb 2017 22:56:40 +0000 (14:56 -0800)]
Merge branch 'jk/doc-remote-helpers-markup-fix'
Doc markup fix.
* jk/doc-remote-helpers-markup-fix:
docs/gitremote-helpers: fix unbalanced quotes
Jeff King [Wed, 15 Feb 2017 21:40:52 +0000 (16:40 -0500)]
show-branch: use skip_prefix to drop magic numbers
We make several starts_with() calls, only to advance
pointers. This is exactly what skip_prefix() is for, which
lets us avoid manually-counted magic numbers.
Helped-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 15 Feb 2017 20:54:20 +0000 (12:54 -0800)]
Merge branch 'sb/doc-unify-bottom'
Doc clean-up.
* sb/doc-unify-bottom:
Documentation: unify bottom "part of git suite" lines
Junio C Hamano [Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)]
Merge branch 'sb/push-options-via-transport'
The push-options given via the "--push-options" option were not
passed through to external remote helpers such as "smart HTTP" that
are invoked via the transport helper.
* sb/push-options-via-transport:
push options: pass push options to the transport helper
Junio C Hamano [Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)]
Merge branch 'cw/completion'
More command line completion (in contrib/) for recent additions.
* cw/completion:
completion: recognize more long-options
completion: teach remote subcommands to complete options
completion: teach replace to complete options
completion: teach ls-remote to complete options
completion: improve bash completion for git-add
completion: add subcommand completion for rerere
completion: teach submodule subcommands to complete options
Junio C Hamano [Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)]
Merge branch 'rs/swap'
Code clean-up.
* rs/swap:
graph: use SWAP macro
diff: use SWAP macro
use SWAP macro
apply: use SWAP macro
add SWAP macro
Junio C Hamano [Wed, 15 Feb 2017 20:54:18 +0000 (12:54 -0800)]
Merge branch 'sb/submodule-doc'
Doc updates.
* sb/submodule-doc:
submodule update documentation: don't repeat ourselves
submodule documentation: add options to the subcommand
Jeff King [Tue, 14 Feb 2017 21:54:36 +0000 (16:54 -0500)]
grep: treat revs the same for --untracked as for --no-index
git-grep has always disallowed grepping in a tree (as
opposed to the working directory) with both --untracked
and --no-index. But we traditionally did so by first
collecting the revs, and then complaining when any were
provided.
The --no-index option recently learned to detect revs
much earlier. This has two user-visible effects:
- we don't bother to resolve revision names at all. So
when there's a rev/path ambiguity, we always choose to
treat it as a path.
- likewise, when you do specify a revision without "--",
the error you get is "no such path" and not "--untracked
cannot be used with revs".
The rationale for doing this with --no-index is that it is
meant to be used outside a repository, and so parsing revs
at all does not make sense.
This patch gives --untracked the same treatment. While it
_is_ meant to be used in a repository, it is explicitly
about grepping the non-repository contents. Telling the user
"we found a rev, but you are not allowed to use revs" is
not really helpful compared to "we treated your argument as
a path, and could not find it".
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder [Tue, 14 Feb 2017 20:36:19 +0000 (15:36 -0500)]
remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
To push from or fetch to the current repository, remote helpers need
to know what repository that is. Accordingly, Git sets the GIT_DIR
environment variable to the path to the current repository when
invoking remote helpers.
There is a special case it does not handle: "git ls-remote" and "git
archive --remote" can be run to inspect a remote repository without
being run from any local repository. GIT_DIR is not useful in this
scenario:
- if we are not in a repository, we don't need to set GIT_DIR to
override an existing GIT_DIR value from the environment. If GIT_DIR
is present then we would be in a repository if it were valid and
would have called die() if it weren't.
- not setting GIT_DIR may cause a helper to do the usual discovery
walk to find the repository. But we know we're not in one, or we
would have found it ourselves. So in the worst case it may expend
a little extra effort to try to find a repository and fail (for
example, remote-curl would do this to try to find repository-level
configuration).
So leave GIT_DIR unset in this case. This makes GIT_DIR easier to
understand for remote helper authors and makes transport code less of
a special case for repository discovery.
Noticed using
b1ef400e (setup_git_env: avoid blind fall-back to
".git", 2016-10-20) from 'next':
$ cd /tmp
$ git ls-remote https://kernel.googlesource.com/pub/scm/git/git
fatal: BUG: setup_git_env called without repository
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>