Elijah Newren [Tue, 17 Sep 2019 16:35:04 +0000 (09:35 -0700)]
clean: fix theoretical path corruption
cmd_clean() had the following code structure:
struct strbuf abs_path = STRBUF_INIT;
for_each_string_list_item(item, &del_list) {
strbuf_addstr(&abs_path, prefix);
strbuf_addstr(&abs_path, item->string);
PROCESS(&abs_path);
strbuf_reset(&abs_path);
}
where I've elided a bunch of unnecessary details and PROCESS(&abs_path)
represents a big chunk of code rather than an actual function call. One
piece of PROCESS was:
if (lstat(abs_path.buf, &st))
continue;
which would cause the strbuf_reset() to be missed -- meaning that the
next path to be handled would have two paths concatenated. This path
used to use die_errno() instead of continue prior to commit
396049e5fb62
("git-clean: refactor git-clean into two phases", 2013-06-25), but my
understanding of how correct_untracked_entries() works is that it will
prevent both dir/ and dir/file from being in the list to clean so this
should be dead code and the die_errno() should be safe. But I hesitate
to remove it since I am not certain.
However, we can fix both this bug and possible similar future bugs by
simply moving the strbuf_reset(&abs_path) to the beginning of the loop.
It'll result in N calls to strbuf_reset() instead of N-1, but that's a
small price to pay to avoid sneaky bugs like this.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:35:03 +0000 (09:35 -0700)]
clean: rewrap overly long line
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:35:02 +0000 (09:35 -0700)]
clean: avoid removing untracked files in a nested git repository
Users expect files in a nested git repository to be left alone unless
sufficiently forced (with two -f's). Unfortunately, in certain
circumstances, git would delete both tracked (and possibly dirty) files
and untracked files within a nested repository. To explain how this
happens, let's contrast a couple cases. First, take the following
example setup (which assumes we are already within a git repo):
git init nested
cd nested
>tracked
git add tracked
git commit -m init
>untracked
cd ..
In this setup, everything works as expected; running 'git clean -fd'
will result in fill_directory() returning the following paths:
nested/
nested/tracked
nested/untracked
and then correct_untracked_entries() would notice this can be compressed
to
nested/
and then since "nested/" is a directory, we would call
remove_dirs("nested/", ...), which would
check is_nonbare_repository_dir() and then decide to skip it.
However, if someone also creates an ignored file:
>nested/ignored
then running 'git clean -fd' would result in fill_directory() returning
the same paths:
nested/
nested/tracked
nested/untracked
but correct_untracked_entries() will notice that we had ignored entries
under nested/ and thus simplify this list to
nested/tracked
nested/untracked
Since these are not directories, we do not call remove_dirs() which was
the only place that had the is_nonbare_repository_dir() safety check --
resulting in us deleting both the untracked file and the tracked (and
possibly dirty) file.
One possible fix for this issue would be walking the parent directories
of each path and checking if they represent nonbare repositories, but
that would be wasteful. Even if we added caching of some sort, it's
still a waste because we should have been able to check that "nested/"
represented a nonbare repository before even descending into it in the
first place. Add a DIR_SKIP_NESTED_GIT flag to dir_struct.flags and use
it to prevent fill_directory() and friends from descending into nested
git repos.
With this change, we also modify two regression tests added in commit
91479b9c72f1 ("t7300: add tests to document behavior of clean and nested
git", 2015-06-15). That commit, nor its series, nor the six previous
iterations of that series on the mailing list discussed why those tests
coded the expectation they did. In fact, it appears their purpose was
simply to test _existing_ behavior to make sure that the performance
changes didn't change the behavior. However, these two tests directly
contradicted the manpage's claims that two -f's were required to delete
files/directories under a nested git repository. While one could argue
that the user gave an explicit path which matched files/directories that
were within a nested repository, there's a slippery slope that becomes
very difficult for users to understand once you go down that route (e.g.
what if they specified "git clean -f -d '*.c'"?) It would also be hard
to explain what the exact behavior was; avoid such problems by making it
really simple.
Also, clean up some grammar errors describing this functionality in the
git-clean manpage.
Finally, there are still a couple bugs with -ffd not cleaning out enough
(e.g. missing the nested .git) and with -ffdX possibly cleaning out the
wrong files (paying attention to outer .gitignore instead of inner).
This patch does not address these cases at all (and does not change the
behavior relative to those flags), it only fixes the handling when given
a single -f. See
https://public-inbox.org/git/
20190905212043.GC32087@szeder.dev/ for more
discussion of the -ffd[X?] bugs.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:35:01 +0000 (09:35 -0700)]
clean: disambiguate the definition of -d
The -d flag pre-dated git-clean's ability to have paths specified. As
such, the default for git-clean was to only remove untracked files in
the current directory, and -d existed to allow it to recurse into
subdirectories.
The interaction of paths and the -d option appears to not have been
carefully considered, as evidenced by numerous bugs and a dearth of
tests covering such pairings in the testsuite. The definition turns out
to be important, so let's look at some of the various ways one could
interpret the -d option:
A) Without -d, only look in subdirectories which contain tracked
files under them; with -d, also look in subdirectories which
are untracked for files to clean.
B) Without specified paths from the user for us to delete, we need to
have some kind of default, so...without -d, only look in
subdirectories which contain tracked files under them; with -d,
also look in subdirectories which are untracked for files to clean.
The important distinction here is that choice B says that the presence
or absence of '-d' is irrelevant if paths are specified. The logic
behind option B is that if a user explicitly asked us to clean a
specified pathspec, then we should clean anything that matches that
pathspec. Some examples may clarify. Should
git clean -f untracked_dir/file
remove untracked_dir/file or not? It seems crazy not to, but a strict
reading of option A says it shouldn't be removed. How about
git clean -f untracked_dir/file1 tracked_dir/file2
or
git clean -f untracked_dir_1/file1 untracked_dir_2/file2
? Should it remove either or both of these files? Should it require
multiple runs to remove both the files listed? (If this sounds like a
crazy question to even ask, see the commit message of "t7300: Add some
testcases showing failure to clean specified pathspecs" added earlier in
this patch series.) What if -ffd were used instead of -f -- should that
allow these to be removed? Should it take multiple invocations with
-ffd? What if a glob (such as '*tracked*') were used instead of
spelling out the directory names? What if the filenames involved globs,
such as
git clean -f '*.o'
or
git clean -f '*/*.o'
?
The current documentation actually suggests a definition that is
slightly different than choice A, and the implementation prior to this
series provided something radically different than either choices A or
B. (The implementation, though, was clearly just buggy). There may be
other choices as well. However, for almost any given choice of
definition for -d that I can think of, some of the examples above will
appear buggy to the user. The only case that doesn't have negative
surprises is choice B: treat a user-specified path as a request to clean
all untracked files which match that path specification, including
recursing into any untracked directories.
Change the documentation and basic implementation to use this
definition.
There were two regression tests that indirectly depended on the current
implementation, but neither was about subdirectory handling. These two
tests were introduced in commit
5b7570cfb41c ("git-clean: add tests for
relative path", 2008-03-07) which was solely created to add coverage for
the changes in commit
fb328947c8e ("git-clean: correct printing relative
path", 2008-03-07). Both tests specified a directory that happened to
have an untracked subdirectory, but both were only checking that the
resulting printout of a file that was removed was shown with a relative
path. Update these tests appropriately.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:35:00 +0000 (09:35 -0700)]
git-clean.txt: do not claim we will delete files with -n/--dry-run
It appears that the wrong option got included in the list of what will
cause git-clean to actually take action. Correct the list.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:59 +0000 (09:34 -0700)]
dir: add commentary explaining match_pathspec_item's return value
The way match_pathspec_item() handles names and pathspecs with trailing
slash characters, in conjunction with special options like
DO_MATCH_DIRECTORY and DO_MATCH_LEADING_PATHSPEC were non-obvious, and
broken until this patch series. Add a table in a comment explaining the
intent of how these work.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:58 +0000 (09:34 -0700)]
dir: if our pathspec might match files under a dir, recurse into it
For git clean, if a directory is entirely untracked and the user did not
specify -d (corresponding to DIR_SHOW_IGNORED_TOO), then we usually do
not want to remove that directory and thus do not recurse into it.
However, if the user manually specified specific (or even globbed) paths
somewhere under that directory to remove, then we need to recurse into
the directory to make sure we remove the relevant paths under that
directory as the user requested.
Note that this does not mean that the recursed-into directory will be
added to dir->entries for later removal; as of a few commits earlier in
this series, there is another more strict match check that is run after
returning from a recursed-into directory before deciding to add it to the
list of entries. Therefore, this will only result in files underneath
the given directory which match one of the pathspecs being added to the
entries list.
Two notes of potential interest to future readers:
* If we wanted to only recurse into a directory when it is specifically
matched rather than matched-via-glob (e.g. '*.c'), then we could do
so via making the final non-zero return in match_pathspec_item be
MATCHED_RECURSIVELY instead of MATCHED_RECURSIVELY_LEADING_PATHSPEC.
(Note that the relative order of MATCHED_RECURSIVELY_LEADING_PATHSPEC
and MATCHED_RECURSIVELY are important for such a change.) I was
leaving open that possibility while writing an RFC asking for the
behavior we want, but even though we don't want it, that knowledge
might help you understand the code flow better.
* There is a growing amount of logic in read_directory_recursive() for
deciding whether to recurse into a subdirectory. However, there is a
comment immediately preceding this logic that says to recurse if
instructed by treat_path(). It may be better for the logic in
read_directory_recursive() to ultimately be moved to treat_path() (or
another function it calls, such as treat_directory()), but I have
left that for someone else to tackle in the future.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:57 +0000 (09:34 -0700)]
dir: make the DO_MATCH_SUBMODULE code reusable for a non-submodule case
The specific checks done in match_pathspec_item for the DO_MATCH_SUBMODULE
case are useful for other cases which have nothing to do with submodules.
Rename this constant; a subsequent commit will make use of this change.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:56 +0000 (09:34 -0700)]
dir: also check directories for matching pathspecs
Even if a directory doesn't match a pathspec, it is possible, depending
on the precise pathspecs, that some file underneath it might. So we
special case and recurse into the directory for such situations. However,
we previously always added any untracked directory that we recursed into
to the list of untracked paths, regardless of whether the directory
itself matched the pathspec.
For the case of git-clean and a set of pathspecs of "dir/file" and "more",
this caused a problem because we'd end up with dir entries for both of
"dir"
"dir/file"
Then correct_untracked_entries() would try to helpfully prune duplicates
for us by removing "dir/file" since it's under "dir", leaving us with
"dir"
Since the original pathspec only had "dir/file", the only entry left
doesn't match and leaves nothing to be removed. (Note that if only one
pathspec was specified, e.g. only "dir/file", then the common_prefix_len
optimizations in fill_directory would cause us to bypass this problem,
making it appear in simple tests that we could correctly remove manually
specified pathspecs.)
Fix this by actually checking whether the directory we are about to add
to the list of dir entries actually matches the pathspec; only do this
matching check after we have already returned from recursing into the
directory.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:55 +0000 (09:34 -0700)]
dir: fix off-by-one error in match_pathspec_item
For a pathspec like 'foo/bar' comparing against a path named "foo/",
namelen will be 4, and match[namelen] will be 'b'. The correct location
of the directory separator is namelen-1.
However, other callers of match_pathspec_item() such as builtin/grep.c's
submodule_path_match() will compare against a path named "foo" instead of
"foo/". It might be better to change all the callers to be consistent,
as discussed at
https://public-inbox.org/git/xmqq7e6cdnkr.fsf@gitster-ct.c.googlers.com/
and
https://public-inbox.org/git/CABPp-BERWUPCPq-9fVW1LNocqkrfsoF4BPj3gJd9+En43vEkTQ@mail.gmail.com/
but there are many cases to audit, so for now just make sure we handle
both cases with and without a trailing slash.
The reason the code worked despite this sometimes-off-by-one error was
that the subsequent code immediately checked whether the first matchlen
characters matched (which they do) and then bailed and return
MATCHED_RECURSIVELY anyway since wildmatch doesn't have the ability to
check if "name" can be matched as a directory (or prefix) against the
pathspec.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:54 +0000 (09:34 -0700)]
dir: fix typo in comment
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren [Tue, 17 Sep 2019 16:34:53 +0000 (09:34 -0700)]
t7300: add testcases showing failure to clean specified pathspecs
Someone brought me a testcase where multiple git-clean invocations were
required to clean out unwanted files:
mkdir d{1,2}
touch d{1,2}/ut
touch d1/t && git add d1/t
With this setup, the user would need to run
git clean -ffd */ut
twice to delete both ut files.
A little testing showed some interesting variants:
* If only one of those two ut files existed (either one), then only one
clean command would be necessary.
* If both directories had tracked files, then only one git clean would
be necessary to clean both files.
* If both directories had no tracked files then the clean command above
would never clean either of the untracked files despite the pathspec
explicitly calling both of them out.
A bisect showed that the failure to clean out the files started with
commit
cf424f5fd89b ("clean: respect pathspecs with "-d", 2014-03-10).
However, that pointed to a separate issue: while the "-d" flag was used
by the original user who showed me this problem, that flag should have
been irrelevant to this problem. Testing again without the "-d" flag
showed that the same buggy behavior exists without using that flag, and
has in fact existed since before
cf424f5fd89b.
Although these problems at first are perceived to be different (e.g.
never clearing out the requested files vs. taking multiple invocations
to get everything cleared out), they are actually just different
manifestations of the same problem. The case with multiple directories
that have no tracked files is the more general case; solving it will
solve all the others. So, I concentrate on it. Add testcases showing
that multiple untracked files within entirely untracked directories
cannot be cleaned when specifying these files to git clean via
pathspecs.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Sun, 25 Aug 2019 18:59:18 +0000 (20:59 +0200)]
t7300-clean: demonstrate deleting nested repo with an ignored file breakage
'git clean -fd' must not delete an untracked directory if it belongs
to a different Git repository or worktree. Unfortunately, if a
'.gitignore' rule in the outer repository happens to match a file in a
nested repository or worktree, then something goes awry and 'git clean
-fd' does delete the content of the nested repository's worktree
except that ignored file, potentially leading to data loss.
Add a test to 't7300-clean.sh' to demonstrate this breakage.
This issue is a regression introduced in
6b1db43109 (clean: teach
clean -d to preserve ignored paths, 2017-05-23).
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 9 Aug 2019 22:20:04 +0000 (15:20 -0700)]
Git 2.22.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philip Oakley [Sun, 11 Aug 2019 15:03:38 +0000 (16:03 +0100)]
.mailmap: update email address of Philip Oakley
My IEE 'home for life' email service is being withdrawn on 30 Sept 2019.
Replace with my new email domain.
I also have a secondary (backup) 'home for life' through
<philipoakley@dunelm.org.uk>.
Signed-off-by: Philip Oakley <philipoakley@iee.email>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 9 Aug 2019 22:18:19 +0000 (15:18 -0700)]
Merge branch 'cb/xdiff-no-system-includes-in-dot-c' into maint
Compilation fix.
* cb/xdiff-no-system-includes-in-dot-c:
xdiff: remove duplicate headers from xpatience.c
xdiff: remove duplicate headers from xhistogram.c
xdiff: drop system includes in xutils.c
Junio C Hamano [Fri, 9 Aug 2019 22:18:18 +0000 (15:18 -0700)]
Merge branch 'jk/no-system-includes-in-dot-c' into maint
Compilation fix.
* jk/no-system-includes-in-dot-c:
wt-status.h: drop stdio.h include
verify-tag: drop signal.h include
Junio C Hamano [Fri, 9 Aug 2019 22:18:18 +0000 (15:18 -0700)]
Merge branch 'sg/fsck-config-in-doc' into maint
Doc update.
* sg/fsck-config-in-doc:
Documentation/git-fsck.txt: include fsck.* config variables
Junio C Hamano [Fri, 9 Aug 2019 22:18:18 +0000 (15:18 -0700)]
Merge branch 'jk/xdiff-clamp-funcname-context-index' into maint
The internal diff machinery can be made to read out of bounds while
looking for --funcion-context line in a corner case, which has been
corrected.
* jk/xdiff-clamp-funcname-context-index:
xdiff: clamp function context indices in post-image
Martin Ågren [Thu, 1 Aug 2019 14:12:20 +0000 (16:12 +0200)]
RelNotes/2.21.1: typofix
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 29 Jul 2019 18:14:47 +0000 (11:14 -0700)]
Merge fixes made on the 'master' front
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Mon, 29 Jul 2019 19:38:23 +0000 (12:38 -0700)]
Merge branch 'jc/post-c89-rules-doc' into maint
We have been trying out a few language features outside c89; the
coding guidelines document did not talk about them and instead had
a blanket ban against them.
* jc/post-c89-rules-doc:
CodingGuidelines: spell out post-C89 rules
Junio C Hamano [Mon, 29 Jul 2019 19:38:23 +0000 (12:38 -0700)]
Merge branch 'fc/fetch-with-import-fix' into maint
Code restructuring during 2.20 period broke fetching tags via
"import" based transports.
* fc/fetch-with-import-fix:
fetch: fix regression with transport helpers
fetch: make the code more understandable
fetch: trivial cleanup
t5801 (remote-helpers): add test to fetch tags
t5801 (remote-helpers): cleanup refspec stuff
Junio C Hamano [Mon, 29 Jul 2019 19:38:22 +0000 (12:38 -0700)]
Merge branch 'ds/close-object-store' into maint
The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.
* ds/close-object-store:
packfile: rename close_all_packs to close_object_store
packfile: close commit-graph in close_all_packs
commit-graph: use raw_object_store when closing
commit-graph: extract write_commit_graph_file()
commit-graph: extract copy_oids_to_commits()
commit-graph: extract count_distinct_commits()
commit-graph: extract fill_oids_from_all_packs()
commit-graph: extract fill_oids_from_commit_hex()
commit-graph: extract fill_oids_from_packs()
commit-graph: create write_commit_graph_context
commit-graph: remove Future Work section
commit-graph: collapse parameters into flags
commit-graph: return with errors during write
commit-graph: fix the_repository reference
Junio C Hamano [Mon, 29 Jul 2019 19:38:22 +0000 (12:38 -0700)]
Merge branch 'pw/add-p-recount' into maint
"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.
* pw/add-p-recount:
add -p: fix checkout -p with pathological context
Junio C Hamano [Mon, 29 Jul 2019 19:38:21 +0000 (12:38 -0700)]
Merge branch 'rs/avoid-overflow-in-midpoint-computation' into maint
Code clean-up to avoid signed integer overlaps during binary search.
* rs/avoid-overflow-in-midpoint-computation:
cleanup: fix possible overflow errors in binary search, part 2
Junio C Hamano [Mon, 29 Jul 2019 19:38:21 +0000 (12:38 -0700)]
Merge branch 'jk/trailers-use-config' into maint
"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.
* jk/trailers-use-config:
interpret-trailers: load default config
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)]
Merge branch 'tg/stash-ref-by-index-fix' into maint
"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.
* tg/stash-ref-by-index-fix:
stash: fix show referencing stash index
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)]
Merge branch 'pw/rebase-abort-clean-rewritten' into maint
"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.
* pw/rebase-abort-clean-rewritten:
rebase --abort/--quit: cleanup refs/rewritten
sequencer: return errors from sequencer_remove_state()
rebase: warn if state directory cannot be removed
rebase: fix a memory leak
Junio C Hamano [Mon, 29 Jul 2019 19:38:20 +0000 (12:38 -0700)]
Merge branch 'nd/completion-no-cache-failure' into maint
An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.
* nd/completion-no-cache-failure:
completion: do not cache if --git-completion-helper fails
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)]
Merge branch 'rs/config-unit-parsing' into maint
The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.
* rs/config-unit-parsing:
config: simplify parsing of unit factors
config: don't multiply in parse_unit_factor()
config: use unsigned_mult_overflows to check for overflows
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)]
Merge branch 'jk/delta-islands-progress-fix' into maint
The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.
* jk/delta-islands-progress-fix:
delta-islands: respect progress flag
Junio C Hamano [Mon, 29 Jul 2019 19:38:19 +0000 (12:38 -0700)]
Merge branch 'sg/rebase-progress' into maint
Use "Erase in Line" CSI sequence that is already used in the editor
support to clear cruft in the progress output.
* sg/rebase-progress:
progress: use term_clear_line()
rebase: fix garbled progress display with '-x'
pager: add a helper function to clear the last line in the terminal
t3404: make the 'rebase.missingCommitsCheck=ignore' test more focused
t3404: modernize here doc style
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)]
Merge branch 'ms/submodule-foreach-fix' into maint
"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.
* ms/submodule-foreach-fix:
submodule foreach: fix recursion of options
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)]
Merge branch 'js/rebase-reschedule-applies-only-to-interactive' into maint
The configuration variable rebase.rescheduleFailedExec should be
effective only while running an interactive rebase and should not
affect anything when running an non-interactive one, which was not
the case. This has been corrected.
* js/rebase-reschedule-applies-only-to-interactive:
rebase --am: ignore rebase.rescheduleFailedExec
Junio C Hamano [Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)]
Merge branch 'qn/clone-doc-use-long-form' into maint
The "git clone" documentation refers to command line options in its
description in the short form; they have been replaced with long
forms to make them more recognisable.
* qn/clone-doc-use-long-form:
docs: git-clone: list short form of options first
docs: git-clone: refer to long form of options
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)]
Merge branch 'jc/denoise-rm-to-resolve' into maint
"git rm" to resolve a conflicted path leaked an internal message
"needs merge" before actually removing the path, which was
confusing. This has been corrected.
* jc/denoise-rm-to-resolve:
rm: resolving by removal is not a warning-worthy event
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)]
Merge branch 'js/mingw-spawn-with-spaces-in-path' into maint
Window 7 update ;-)
* js/mingw-spawn-with-spaces-in-path:
mingw: support spawning programs containing spaces in their names
Junio C Hamano [Mon, 29 Jul 2019 19:38:17 +0000 (12:38 -0700)]
Merge branch 'sr/gpg-interface-stop-at-the-end' into maint
A codepath that reads from GPG for signed object verification read
past the end of allocated buffer, which has been fixed.
* sr/gpg-interface-stop-at-the-end:
gpg-interface: do not scan past the end of buffer
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)]
Merge branch 'js/clean-report-too-long-a-path' into maint
"git clean" silently skipped a path when it cannot lstat() it; now
it gives a warning.
* js/clean-report-too-long-a-path:
clean: show an error message when the path is too long
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)]
Merge branch 'es/local-atomic-push-failure-with-http' into maint
"git push --atomic" that goes over the transport-helper (namely,
the smart http transport) failed to prevent refs to be pushed when
it can locally tell that one of the ref update will fail without
having to consult the other end, which has been corrected.
* es/local-atomic-push-failure-with-http:
transport-helper: avoid var decl in for () loop control
transport-helper: enforce atomic in push_refs_with_push
Junio C Hamano [Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)]
Merge branch 'po/doc-branch' into maint
Doc update.
* po/doc-branch:
doc branch: provide examples for listing remote tracking branches
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)]
Merge branch 'dl/config-alias-doc' into maint
Doc update.
* dl/config-alias-doc:
config/alias.txt: document alias accepting non-command first word
config/alias.txt: change " and ' to `
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)]
Merge branch 'cb/fsmonitor-intfix' into maint
Variable type fix.
* cb/fsmonitor-intfix:
fsmonitor: avoid signed integer overflow / infinite loop
Junio C Hamano [Mon, 29 Jul 2019 19:38:15 +0000 (12:38 -0700)]
Merge branch 'rs/copy-array' into maint
Code clean-up.
* rs/copy-array:
use COPY_ARRAY for copying arrays
coccinelle: use COPY_ARRAY for copying arrays
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)]
Merge branch 'js/t3404-typofix' into maint
Typofix.
* js/t3404-typofix:
t3404: fix a typo
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)]
Merge branch 'cb/mkstemps-uint-type-fix' into maint
Variable type fix.
* cb/mkstemps-uint-type-fix:
wrapper: avoid undefined behaviour in macOS
Junio C Hamano [Mon, 29 Jul 2019 19:38:14 +0000 (12:38 -0700)]
Merge branch 'js/t0001-case-insensitive' into maint
Test update.
* js/t0001-case-insensitive:
t0001: fix on case-insensitive filesystems
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)]
Merge branch 'jw/gitweb-sample-update' into maint
Doc update.
* jw/gitweb-sample-update:
doc: don't use git.kernel.org as example gitweb URL
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)]
Merge branch 'sg/t5551-fetch-smart-error-is-translated' into maint
Test update.
* sg/t5551-fetch-smart-error-is-translated:
t5551: use 'test_i18ngrep' to check translated output
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)]
Merge branch 'jt/t5551-test-chunked' into maint
Update smart-http test.
* jt/t5551-test-chunked:
t5551: test usage of chunked encoding explicitly
Junio C Hamano [Mon, 29 Jul 2019 19:38:13 +0000 (12:38 -0700)]
Merge branch 'sg/git-C-empty-doc' into maint
Doc update.
* sg/git-C-empty-doc:
Document that 'git -C ""' works and doesn't change directory
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)]
Merge branch 'sg/ci-brew-gcc-workaround' into maint
Dev support update.
* sg/ci-brew-gcc-workaround:
ci/lib.sh: update a comment about installed P4 and Git-LFS versions
ci: disable Homebrew's auto cleanup
ci: don't update Homebrew
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)]
Merge branch 'js/trace2-signo-typofix' into maint
Documentation fix.
* js/trace2-signo-typofix:
trace2: correct trace2 field name documentation
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)]
Merge branch 'di/readme-markup-fix' into maint
Docfix.
* di/readme-markup-fix:
README: fix rendering of text in angle brackets
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)]
Merge branch 'vn/xmmap-gently' into maint
Clean-up an error codepath.
* vn/xmmap-gently:
read-cache.c: do not die if mmap fails
Junio C Hamano [Mon, 29 Jul 2019 19:38:12 +0000 (12:38 -0700)]
Merge branch 'rm/gpg-program-doc-fix' into maint
Docfix.
* rm/gpg-program-doc-fix:
gpg(docs): use correct --verify syntax
Junio C Hamano [Mon, 29 Jul 2019 19:38:11 +0000 (12:38 -0700)]
Merge branch 'js/unmap-before-ext-diff' into maint
Windows update.
* js/unmap-before-ext-diff:
diff: munmap() file contents before running external diff
Junio C Hamano [Mon, 29 Jul 2019 19:38:11 +0000 (12:38 -0700)]
Merge branch 'js/gcc-8-and-9' into maint
Code clean-up for new compilers.
The 'kwset' one may get a wholesale replacement, either with new
version of kwset from upstream or removal of its users, but in the
meantime, it is probably OK to merge it down.
* js/gcc-8-and-9:
config: avoid calling `labs()` on too-large data type
winansi: simplify loading the GetCurrentConsoleFontEx() function
kwset: allow building with GCC 8
poll (mingw): allow compiling with GCC 8 and DEVELOPER=1
SZEDER Gábor [Mon, 29 Jul 2019 09:59:14 +0000 (11:59 +0200)]
Documentation/git-fsck.txt: include fsck.* config variables
The 'fsck.skipList' and 'fsck.<msg-id>' config variables might be
easier to discover when they are documented in 'git fsck's man page.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Carlo Marcelo Arenas Belón [Sun, 28 Jul 2019 20:07:24 +0000 (13:07 -0700)]
xdiff: remove duplicate headers from xpatience.c
92b7de93fb (Implement the patience diff algorithm, 2009-01-07) added them
but were already part of xinclude.h
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Carlo Marcelo Arenas Belón [Sun, 28 Jul 2019 20:07:23 +0000 (13:07 -0700)]
xdiff: remove duplicate headers from xhistogram.c
8c912eea94 ("teach --histogram to diff", 2011-07-12) included them, but
were already part of xinclude.h
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Carlo Marcelo Arenas Belón [Sun, 28 Jul 2019 20:07:22 +0000 (13:07 -0700)]
xdiff: drop system includes in xutils.c
After
b46054b374 ("xdiff: use git-compat-util", 2019-04-11), two system
headers added with
6942efcfa9 ("xdiff: load full words in the inner loop
of xdl_hash_record", 2012-04-06) to xutils.c are no longer needed and
could conflict as shown below from an OpenIndiana build:
In file included from xdiff/xinclude.h:26:0,
from xdiff/xutils.c:25:
./git-compat-util.h:4:0: warning: "_FILE_OFFSET_BITS" redefined
#define _FILE_OFFSET_BITS 64
In file included from /usr/include/limits.h:37:0,
from xdiff/xutils.c:23:
/usr/include/sys/feature_tests.h:231:0: note: this is the location of the previous definition
#define _FILE_OFFSET_BITS 32
Make sure git-compat-util.h is the first header (through xinclude.h)
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 25 Jul 2019 21:32:36 +0000 (14:32 -0700)]
Flush fixes up to the third batch post 2.22.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 25 Jul 2019 21:27:16 +0000 (14:27 -0700)]
Merge branch 'ab/hash-object-doc' into maint
Doc update.
* ab/hash-object-doc:
hash-object doc: stop mentioning git-cvsimport
Junio C Hamano [Thu, 25 Jul 2019 21:27:15 +0000 (14:27 -0700)]
Merge branch 'cm/send-email-document-req-modules' into maint
A doc update.
* cm/send-email-document-req-modules:
send-email: update documentation of required Perl modules
Junio C Hamano [Thu, 25 Jul 2019 21:27:15 +0000 (14:27 -0700)]
Merge branch 'sw/git-p4-unshelve-branched-files' into maint
"git p4" update.
* sw/git-p4-unshelve-branched-files:
git-p4: allow unshelving of branched files
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)]
Merge branch 'js/bisect-helper-check-get-oid-return-value' into maint
Code cleanup.
* js/bisect-helper-check-get-oid-return-value:
bisect--helper: verify HEAD could be parsed before continuing
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)]
Merge branch 'es/git-debugger-doc' into maint
Doc update.
* es/git-debugger-doc:
doc: hint about GIT_DEBUGGER in CodingGuidelines
Junio C Hamano [Thu, 25 Jul 2019 21:27:14 +0000 (14:27 -0700)]
Merge branch 'mo/clang-format-for-each-update' into maint
The list of for-each like macros used by clang-format has been
updated.
* mo/clang-format-for-each-update:
clang-format: use git grep to generate the ForEachMacros list
Junio C Hamano [Thu, 25 Jul 2019 21:27:13 +0000 (14:27 -0700)]
Merge branch 'md/url-parse-harden' into maint
The URL decoding code has been updated to avoid going past the end
of the string while parsing %-<hex>-<hex> sequence.
* md/url-parse-harden:
url: do not allow %00 to represent NUL in URLs
url: do not read past end of buffer
Junio C Hamano [Thu, 25 Jul 2019 21:27:13 +0000 (14:27 -0700)]
Merge branch 'an/ignore-doc-update' into maint
The description about slashes in gitignore patterns (used to
indicate things like "anchored to this level only" and "only
matches directories") has been revamped.
* an/ignore-doc-update:
gitignore.txt: make slash-rules more readable
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)]
Merge branch 'md/list-objects-filter-memfix' into maint
The filter_data used in the list-objects-filter (which manages a
lazily sparse clone repository) did not use the dynamic array API
correctly---'nr' is supposed to point at one past the last element
of the array in use. This has been corrected.
* md/list-objects-filter-memfix:
list-objects-filter: correct usage of ALLOC_GROW
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)]
Merge branch 'jt/partial-clone-missing-ref-delta-base' into maint
"git fetch" into a lazy clone forgot to fetch base objects that are
necessary to complete delta in a thin packfile, which has been
corrected.
* jt/partial-clone-missing-ref-delta-base:
t5616: cover case of client having delta base
t5616: use correct flag to check object is missing
index-pack: prefetch missing REF_DELTA bases
t5616: refactor packfile replacement
Junio C Hamano [Thu, 25 Jul 2019 21:27:12 +0000 (14:27 -0700)]
Merge branch 'xl/record-partial-clone-origin' into maint
When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.
* xl/record-partial-clone-origin:
clone: respect user supplied origin name when setting up partial clone
Junio C Hamano [Thu, 25 Jul 2019 21:27:11 +0000 (14:27 -0700)]
Merge branch 'pb/request-pull-verify-remote-ref' into maint
"git request-pull" learned to warn when the ref we ask them to pull
from in the local repository and in the published repository are
different.
* pb/request-pull-verify-remote-ref:
request-pull: warn if the remote object is not the same as the local one
request-pull: quote regex metacharacters in local ref
Junio C Hamano [Thu, 25 Jul 2019 21:27:11 +0000 (14:27 -0700)]
Merge branch 'mm/p4-unshelve-windows-fix' into maint
The command line to invoke a "git cat-file" command from inside
"git p4" was not properly quoted to protect a caret and running a
broken command on Windows, which has been corrected.
* mm/p4-unshelve-windows-fix:
p4 unshelve: fix "Not a valid object name HEAD0" on Windows
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)]
Merge branch 'bb/unicode-12.1-reiwa' into maint
Update to Unicode 12.1 width table.
* bb/unicode-12.1-reiwa:
unicode: update the width tables to Unicode 12.1
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)]
Merge branch 'js/fsmonitor-unflake' into maint
The data collected by fsmonitor was not properly written back to
the on-disk index file, breaking t7519 tests occasionally, which
has been corrected.
* js/fsmonitor-unflake:
mark_fsmonitor_valid(): mark the index as changed if needed
fill_stat_cache_info(): prepare for an fsmonitor fix
Junio C Hamano [Thu, 25 Jul 2019 21:27:10 +0000 (14:27 -0700)]
Merge branch 'vv/merge-squash-with-explicit-commit' into maint
"git merge --squash" is designed to update the working tree and the
index without creating the commit, and this cannot be countermanded
by adding the "--commit" option; the command now refuses to work
when both options are given.
* vv/merge-squash-with-explicit-commit:
merge: refuse --commit with --squash
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)]
Merge branch 'js/bundle-verify-require-object-store' into maint
"git bundle verify" needs to see if prerequisite objects exist in
the receiving repository, but the command did not check if we are
in a repository upfront, which has been corrected.
* js/bundle-verify-require-object-store:
bundle verify: error out if called without an object database
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)]
Merge branch 'jk/am-i-resolved-fix' into maint
"git am -i --resolved" segfaulted after trying to see a commit as
if it were a tree, which has been corrected.
* jk/am-i-resolved-fix:
am: fix --interactive HEAD tree resolution
am: drop tty requirement for --interactive
am: read interactive input from stdin
am: simplify prompt response handling
Junio C Hamano [Thu, 25 Jul 2019 21:27:09 +0000 (14:27 -0700)]
Merge branch 'jk/HEAD-symref-in-xfer-namespaces' into maint
The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.
* jk/HEAD-symref-in-xfer-namespaces:
upload-pack: strip namespace from symref data
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)]
Merge branch 'ew/server-info-remove-crufts' into maint
"git update-server-info" used to leave stale packfiles in its
output, which has been corrected.
* ew/server-info-remove-crufts:
server-info: do not list unlinked packs
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)]
Merge branch 'es/grep-require-name-when-needed' into maint
More parameter validation.
* es/grep-require-name-when-needed:
grep: fail if call could output and name is null
Junio C Hamano [Thu, 25 Jul 2019 21:27:08 +0000 (14:27 -0700)]
Merge branch 'ds/object-info-for-prefetch-fix' into maint
Code cleanup and futureproof.
* ds/object-info-for-prefetch-fix:
sha1-file: split OBJECT_INFO_FOR_PREFETCH
Junio C Hamano [Thu, 25 Jul 2019 21:27:07 +0000 (14:27 -0700)]
Merge branch 'mh/import-transport-fd-fix' into maint
The ownership rule for the file descriptor to fast-import remote
backend was mixed up, leading to unrelated file descriptor getting
closed, which has been fixed.
* mh/import-transport-fd-fix:
Use xmmap_gently instead of xmmap in use_pack
dup() the input fd for fast-import used for remote helpers
Junio C Hamano [Thu, 25 Jul 2019 21:27:07 +0000 (14:27 -0700)]
Merge branch 'nd/corrupt-worktrees' into maint
"git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.
* nd/corrupt-worktrees:
worktree add: be tolerant of corrupt worktrees
Junio C Hamano [Thu, 25 Jul 2019 21:27:06 +0000 (14:27 -0700)]
Merge branch 'nd/init-relative-template-fix' into maint
A relative pathname given to "git init --template=<path> <repo>"
ought to be relative to the directory "git init" gets invoked in,
but it instead was made relative to the repository, which has been
corrected.
* nd/init-relative-template-fix:
init: make --template path relative to $CWD
Jeff King [Tue, 23 Jul 2019 19:27:05 +0000 (15:27 -0400)]
xdiff: clamp function context indices in post-image
After finding a function line for --function-context in the pre-image,
xdl_emit_diff() calculates the equivalent line in the post-image. It
assumes that the lines between changes are the same on both sides. If
the option --ignore-blank-lines was also given then this is not
necessarily true.
Clamp the calculation results for start and end of the function context
to prevent out-of-bounds array accesses.
Note that this _just_ fixes the case where our mismatch sends us off the
beginning of the file. There are likely other cases where our assumption
causes us to go to the wrong line within the file. Nobody has developed
a test case yet, and the ultimate fix is likely more complicated than
this patch. But this at least prevents a segfault in the meantime.
Credit for finding the bug goes to "Liu Wei of Tencent Security Xuanwu
Lab".
Reported-by: 刘炜 <lw17qhdz@gmail.com>
Helped-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Thu, 18 Jul 2019 09:30:33 +0000 (02:30 -0700)]
clean: show an error message when the path is too long
When `lstat()` failed, `git clean` would abort without an error
message, leaving the user quite puzzled.
In particular on Windows, where the default maximum path length is
quite small (yet there are ways to circumvent that limit in many
cases), it is very important that users be given an indication why
their command failed because of too long paths when it did.
This test case makes sure that a warning is issued that would have
helped the user who reported this issue:
https://github.com/git-for-windows/git/issues/521
Note that we temporarily set `core.longpaths = false` in the regression
test; this ensures forward-compatibility with the `core.longpaths`
feature that has not yet been upstreamed from Git for Windows.
Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 16 Jul 2019 17:21:20 +0000 (10:21 -0700)]
CodingGuidelines: spell out post-C89 rules
Even though we have been sticking to C89, there are a few handy
features we borrow from more recent C language in our codebase after
trying them in weather balloons and saw that nobody screamed.
Spell them out.
While at it, extend the existing variable declaration rule a bit to
read better with the newly spelled out rule for the for loop.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Doug Ilijev [Thu, 18 Jul 2019 19:08:45 +0000 (12:08 -0700)]
README: fix rendering of text in angle brackets
Markdown incorrectly interpreted `<commandname>` as an HTML tag;
use backticks to escape `Documentation/git-<commandname>.txt` to ensure
that it renders the text as intended.
Signed-off-by: Doug Ilijev <doug.ilijev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 17 Jul 2019 20:28:24 +0000 (13:28 -0700)]
rm: resolving by removal is not a warning-worthy event
When resolving a conflict on a path in favor of removing it, using
"git rm" on it is the standard way to do so. The user however is
greeted with a "needs merge" message during that operation:
$ git merge side-branch
$ edit conflicted-path-1
$ git add conflicted-path-1
$ git rm conflicted-path-2
conflicted-path-2: needs merge
rm 'conflicted-path-2'
The removal by "git rm" does get performed, but an uninitiated user
may find it confusing, "needs merge? so I need to resolve conflict
before being able to remove it???"
The message is coming from "update-index --refresh" that is called
internally to make sure "git rm" knows which paths are clean and
which paths are dirty, in order to prevent removal of paths modified
relative to the index without the "-f" option. We somehow ended up
not squelching this message which seeped through to the UI surface.
Use the same mechanism used by "git commit", "git describe", etc. to
squelch the message.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 16 Jul 2019 20:28:21 +0000 (13:28 -0700)]
transport-helper: avoid var decl in for () loop control
We do allow a few selected C99 constructs in our codebase these
days, but this is not among them (yet).
Reported-by: Carlo Arenas <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Tue, 16 Jul 2019 14:03:12 +0000 (07:03 -0700)]
mingw: support spawning programs containing spaces in their names
On some older Windows versions (e.g. Windows 7), the CreateProcessW()
function does not really support spaces in its first argument,
lpApplicationName. But it supports passing NULL as lpApplicationName,
which makes it figure out the application from the (possibly quoted)
first argument of lpCommandLine.
Let's use that trick (if we are certain that the first argument matches
the executable's path) to support launching programs whose path contains
spaces.
We will abuse the test-fake-ssh.exe helper to verify that this works and
does not regress.
This fixes https://github.com/git-for-windows/git/issues/692
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Steven Roberts [Tue, 16 Jul 2019 18:47:37 +0000 (11:47 -0700)]
gpg-interface: do not scan past the end of buffer
If the GPG output ends with trailing blank lines, after skipping
them over inside the loop to find the terminating NUL at the end,
the loop ends up looking for the next line, starting past the end.
Signed-off-by: Steven Roberts <sroberts@fenderq.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Varun Naik [Sun, 14 Jul 2019 03:01:53 +0000 (20:01 -0700)]
read-cache.c: do not die if mmap fails
do_read_index() mmaps the index, or tries to die with an error message
on failure. It should call xmmap_gently(), which returns MAP_FAILED,
rather than xmmap(), which dies with its own error message.
An easy way to cause this mmap to fail is by setting $GIT_INDEX_FILE to
a path to a directory and then invoking any command that reads from the
index.
Signed-off-by: Varun Naik <vcnaik94@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Robert Morgan [Fri, 12 Jul 2019 15:33:57 +0000 (08:33 -0700)]
gpg(docs): use correct --verify syntax
The gpg --verify usage example within the 'gpg.program' variable
reference provides an incorrect example of the gpg --verify command
arguments.
The command argument order, when providing both a detached signature
and data, should be signature first and data second:
https://gnupg.org/documentation/manuals/gnupg/Operational-GPG-Commands.html
Signed-off-by: Robert Morgan <robert.thomas.morgan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Emily Shaffer [Thu, 11 Jul 2019 21:19:19 +0000 (14:19 -0700)]
transport-helper: enforce atomic in push_refs_with_push
Teach transport-helper how to notice if skipping a ref during push would
violate atomicity on the client side. We notice that a ref would be
rejected, and choose not to send it, but don't notice that if the client
has asked for --atomic we are violating atomicity if all the other
pushes we are sending would succeed. Asking the server end to uphold
atomicity wouldn't work here as the server doesn't have any idea that we
tried to update a ref that's broken.
The added test-case is a succinct way to reproduce this issue that fails
today. The same steps work fine when we aren't using a transport-helper
to get to the upstream, i.e. when we've added a local repository as a
remote:
git remote add ~/upstream upstream
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>