Earlier, it would error out while trying to read and/or writing them.
Now, calling merge-file with empty files is neither interesting nor
useful, but it is a bug that needed fixing.
Noticed by Clemens Buchacher.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
File mode changes should be handled similarly to changes of content.
That is, if the file mode changed in only one branch, keep the changed
version, and if both branch changed to different mode, mark it as a
conflict.
Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-objects: proper pack time stamping with --max-pack-size
Runtime pack access is done in the pack file mtime order since recent
packs are more likely to contain frequently used objects than old packs.
However the --max-pack-size option can produce multiple packs with mtime
in the reversed order as newer objects are always written first.
Let's modify mtime of later pack files (when any) so they appear older
than preceding ones when a repack creates multiple packs.
On some systems, 'sh' isn't very friendly. In particular,
t7003 fails on Solaris because it doesn't understand $().
Instead, use the specified SHELL_PATH to run shell code.
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Previously, we just chose whether to allow external grep
based on the __unix__ define. However, there are systems
which define this macro but which have an inferior group
(e.g., one that does not support all options used by t7002).
This allows users to accept the potential speed penalty to
get a more consistent grep experience (and to pass the
testsuite).
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.
This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".
On systems with a less-capable diff, you can do:
GIT_TEST_CMP=cmp make test
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
The "-n" syntax is not supported by System V versions of
tail (which prefer "tail -1"). Unfortunately "tail -1" is
not actually POSIX. We had some of both forms in our
scripts.
Since neither form works everywhere, this patch replaces
both with the equivalent sed invocation:
sed -ne '$p'
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
System V versions of grep (such as Solaris /usr/bin/grep)
don't understand either of these options. git's usage of
"grep -e pattern" fell into one of two categories:
1. equivalent to "grep pattern". -e is only useful here if
the pattern begins with a "-", but all of the patterns
are hardcoded and do not begin with a dash.
2. stripping comments and blank lines with
grep -v -e "^$" -e "^#"
We can fortunately do this in the affirmative as
grep '^[^#]'
Uses of "-q" can be replaced with redirection to /dev/null.
In many tests, however, "grep -q" is used as "if this string
is in the expected output, we are OK". In this case, it is
fine to just remove the "-q" entirely; it simply makes the
"verbose" mode of the test slightly more verbose.
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dealing with NULs is not always safe with tr. On Solaris,
incoming NULs are silently deleted by both the System V and
UCB versions of tr. When converting to NULs, the System V
version works fine, but the UCB version silently ignores the
request to convert the character.
This patch changes all instances of tr using NULs to use
"perl -pe 'y///'" instead.
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Older versions of perl (such as 5.005) don't understand -CO, nor
do they understand the "U" pack specifier. Instead of using perl,
let's just printf the binary bytes we are interested in.
Signed-off-by: Jeff King <peff@peff.net> Tested-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-p4: Use P4EDITOR environment variable when set
Perforce allows you to set the P4EDITOR environment variable to your
preferred editor for use in perforce. Since we are displaying a
perforce changelog to the user we should use it when it is defined.
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
A custom diffing utility can be specified for the 'p4 diff' command by
setting the P4DIFF environment variable. However when using a custom
diffing utility such as 'vimdiff' passing options like -du can cause
unexpected behavior.
Since the goal is to generate a unified diff of the changes and attach
them to the bottom of the p4 submit log we should unset P4DIFF if it
has been set in order to generate the diff properly.
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
Prior to commit 8320199 (Rewrite builtin-fetch option parsing to use
parse_options().), we understood '-n' as a short option to mean "don't
fetch tags from the remote". This patch reinstates behaviour similar,
but not identical to the pre commit 8320199 times.
Back then, -n always overrode --tags, so if both --tags and -n was
given on command-line, no tags were fetched regardless of argument
ordering. Now we use a "last entry wins" strategy, so '-n --tags'
means "fetch tags".
Since it's patently absurd to say both --tags and --no-tags, this
shouldn't matter in practice.
Spotted-by: Artem Zolochevskiy <azol@altlinux.org> Reported-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Tested-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
The only reason we did not call "prune" in git-gc was that it is an
inherently dangerous operation: if there is a commit going on, you will
prune loose objects that were just created, and are, in fact, needed by the
commit object just about to be created.
Since it is dangerous, we told users so. That led to many users not even
daring to run it when it was actually safe. Besides, they are users, and
should not have to remember such details as when to call git-gc with
--prune, or to call git-prune directly.
Of course, the consequence was that "git gc --auto" gets triggered much
more often than we would like, since unreferenced loose objects (such as
left-overs from a rebase or a reset --hard) were never pruned.
Alas, git-prune recently learnt the option --expire <minimum-age>, which
makes it a much safer operation. This allows us to call prune from git-gc,
with a grace period of 2 weeks for the unreferenced loose objects (this
value was determined in a discussion on the git list as a safe one).
If you want to override this grace period, just set the config variable
gc.pruneExpire to a different value; an example would be
[gc]
pruneExpire = 6.months.ago
or even "never", if you feel really paranoid.
Note that this new behaviour makes "--prune" be a no-op.
While adding a test to t5304-prune.sh (since it really tests the implicit
call to "prune"), also the original test for "prune --expire" was moved
there from t1410-reflog.sh, where it did not belong.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
help: warn if specified 'man.viewer' is unsupported, instead of erroring out
When a document viewer that is unknown to the current version of git is
specified in the .git/config file, instead of erroring out the process
entirely, just issue a warning. It might be that the user usually is
using a newer git that supports it (and the configuration is written for
that version) but is temporarily using an older git that does not know the
viewer.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Specifying character ranges in tr differs between System V
and POSIX. In System V, brackets are required (e.g.,
'[A-Z]'), whereas in POSIX they are not.
We can mostly get around this by just using the bracket form
for both sets, as in:
tr '[A-Z] '[a-z]'
in which case POSIX interpets this as "'[' becomes '['",
which is OK.
However, this doesn't work with multiple sequences, like:
# rot13
tr '[A-Z][a-z]' '[N-Z][A-M][n-z][a-m]'
where the POSIX version does not behave the same as the
System V version. In this case, we must simply enumerate the
sequence.
This patch fixes problematic uses of tr in git scripts and
test scripts in one of three ways:
- if a single sequence, make sure it uses brackets
- if multiple sequences, enumerate
- if extra brackets (e.g., tr '[A]' 'a'), eliminate
brackets
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb: Fix bug in href(..., -replay=>1) when using 'pathinfo' form
URLs generated by href(..., -replay=>1) (which includes 'next page'
links and alternate view links) didn't set project info correctly
when current page URL is in pathinfo form.
This was caused by the fact that href() always replays params in the
arrayref form, were they multivalued or singlevalued, and the code
dealing with 'pathinfo' feature couldn't deal with $params{'project'}
being arrayref.
Setting $params{'project'} is moved before replaying params; this
ensures that 'project' parameter is processed correctly.
Noticed-by: Peter Oberndorfer <kumbayo84@arcor.de> Noticed-by: Wincent Colaiuta <win@wincent.com> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile: DIFF_OBJS is not special at all these days
It used to make sense back when nothing but diff-files, diff-index and
friends depended on diffcore infrastructure, but pretty much everything
depends on revision infrastructure which in turn depends on DIFF_OBJS.
There is no reason to treat them any differently in the Makefile.
This patch teaches git-submodule an option '--summary-limit|-n <number>'
to limit number of commits in total for the summary of each submodule in
the modified case (only a single commit is shown in other cases).
Giving 0 will disable the summary; a negative number means unlimted, which
is the default.
Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
where the sha1_src is from the given super project commit and the
sha1_dst is from the index or working tree (switched by --cached).
For a deleted, added, or typechanged (blob<->submodule) submodule,
only one single newest commit from the existing end (for example,
src end for submodule deleted or type changed from submodule to blob)
will be shown.
If the src/dst sha1 for a submodule is missing in the submodule
directory, a warning will be issued except in two cases where the
submodule directory is deleted (type 'D') or typechanged to blob
(one case of type 'T').
In the title line for a submodule, the src/dst sha1 and the number
of commits (--first-parent) between the two commits will be shown.
The following example demonstrates most cases.
Example: commit summary for modified submodules sm1-sm5.
--------------------------------------------
$ git submodule summary
* sm1 354cd45...3f751e5 (4):
< one line message for C
< one line message for B
> one line message for D
> one line message for E
* sm2 5c8bfb5...000000 (3):
< one line message for F
This allows multiple viewer candidates to be listed in the configuration
file, like this:
[man]
viewer = woman
viewer = konqueror
viewer = man
The candidates are tried in the order listed in the configuration file,
and the first suitable one (e.g. konqueror cannot be used outside windowed
environment) is used.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Tested-by: Xavier Maillard <xma@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
help: add "man.viewer" config var to use "woman" or "konqueror"
This patch makes it possible to view man pages using other tools
than the "man" program. It also implements support for emacs'
"woman" and konqueror with the man KIO slave to view man pages.
Note that "emacsclient" is used with option "-e" to launch "woman"
on emacs and this works only on versions >= 22.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Tested-by: Xavier Maillard <xma@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git://repo.or.cz/git-gui:
git-gui: Simplify MSGFMT setting in Makefile
git-gui: Add option for changing the width of the commit message text box
git-gui: if a background colour is set, set foreground colour as well
git-gui: translate the remaining messages in zh_cn.po to chinese
To prepare msg files for Tcl scripts, the command that is set to MSGFMT
make variable needs to be able to grok "--tcl -l <lang> -d <here>" options
correctly. This patch simplifies the tests done in git-gui's Makefile to
directly test this condition. If the test run does not exit properly with
zero status (either because you do not have "msgfmt" itself, or your
"msgfmt" is too old to grok --tcl option --- the reason does not matter),
have it fall back to po/po2msg.sh
Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* js/remote:
"remote update": print remote name being fetched from
builtin remote rm: remove symbolic refs, too
remote: fix "update [group...]"
remote show: Clean up connection correctly if object fetch wasn't done
builtin-remote: prune remotes correctly that were added with --mirror
Make git-remote a builtin
Test "git remote show" and "git remote prune"
parseopt: add flag to stop on first non option
path-list: add functions to work with unsorted lists
* lt/unpack-trees:
unpack_trees(): fix diff-index regression.
traverse_trees_recursive(): propagate merge errors up
unpack_trees(): minor memory leak fix in unused destination index
Make 'unpack_trees()' have a separate source and destination index
Make 'unpack_trees()' take the index to work on as an argument
Add 'const' where appropriate to index handling functions
Fix tree-walking compare_entry() in the presense of --prefix
Move 'unpack_trees()' over to 'traverse_trees()' interface
Make 'traverse_trees()' traverse conflicting DF entries in parallel
Add return value to 'traverse_tree()' callback
Make 'traverse_tree()' use linked structure rather than 'const char *base'
Add 'df_name_compare()' helper function
"remote update": print remote name being fetched from
When the other end has dangling symref, "git fetch" issues an error
message but that is not grave enough to cause the fetch process to fail.
As the result, the user will see something like this:
* maint:
git-svn: fix find-rev error message when missing arg
t0021: tr portability fix for Solaris
launch_editor(): allow spaces in the filename
git rebase --abort: always restore the right commit
git-svn: fix find-rev error message when missing arg
Just let the user know that a revision argument is missing instead of
a perl error. This error message mimic the "init" error message, but
could be improved.
Signed-off-by: Marc-Andre Lureau <marcandre.lureau@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
These patches teach git-submodule a new subcommand 'summary' to show
commit summary of checked out submodules between a given super project
commit (defaults to HEAD) and working tree (or index, when --cached is
given).
This patch just introduces the framework to find submodules which have
summary to show. A submodule will have summary if it falls into these
cases:
- type 'M': modified and checked out (1)
- type 'A': added and checked out (2)
- type 'D': deleted
- type 'T': typechanged (blob <-> submodule)
Notes:
1. There may be modified but not checked out cases. In the case of a
merge conflict, even if the submodule is not checked out, there may
be still a diff between index and HEAD on the submodule entry
(i.e. modified). The summary will not be show for such a submodule.
2. A similar explanation applies to the added but not checked out case.
Signed-off-by: Ping Yin <pkufranky@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
does not pick up quotes in <editor>, so you cannot give path to the
editor that has a shell IFS whitespace in it, and also give it initial
set of parameters and flags. Replace $0 with <editor> to fix this issue.
git rebase --abort: always restore the right commit
Previously, --abort would end by git resetting to ORIG_HEAD, but some
commands, such as git reset --hard (which happened in git rebase --skip,
but could just as well be typed by the user), would have already modified
ORIG_HEAD.
Just use the orig-head we store in $dotest instead.
[jc: cherry-picked from 48411d and 4947cf9 on 'master']
Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michele Ballabio <barra_cuda@katamail.com> pointed out that gitk
sometimes throws a Tcl error (can't read "yscreen") when switching
views, and proposed a patch. This is a different way of fixing it
which is a bit neater. Basically, in showview we only set yscreen if
the selected commit is on screen to start with, and then we only
scroll the canvas to bring it onscreen if yscreen is set and the
same commit exists in the new view.
[PATCH] gitk: Don't show local changes when we there is no work tree
Launching gitk on a bare repository or a .git directory
would previously show the work tree as having removed all
files. We now inhibit showing local changes when gitk
is not launched from within a work tree.
Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz> Tested-by: Mike Ralphson <mike@abacus.co.uk> Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
When skip_unmerged option is not given, unpack_trees() should not just
skip unmerged cache entries but keep them in the result for the caller to
sort them out.
For callers other than diff-index, the incoming index should never be
unmerged, but diff-index is a special case caller.
Being in the project's top directory when starting or continuing a rebase
is not necessary since 533b703 (Allow whole-tree operations to be started
from a subdirectory, 2007-01-12).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
bash: fix long option with argument double completion
Pressing TAB right after 'git command --long-option=' results in
'git command --long-option=--long-option=' when the long option requires
an argument, but we don't provide completion for its arguments (e.g.
commit --author=, apply --exclude=). This patch detects these long
options and provides empty completion array for them.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
bash: use __gitdir when completing 'git rebase' options
When doing completion of rebase options in a subdirectory of the work
tree during an ongoing rebase, wrong options were offered because of the
hardcoded .git/.dotest-merge path.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
bash: refactor searching for subcommands on the command line
This patch adds the __git_find_subcommand function, which takes one
argument: a string containing all subcommands separated by spaces. The
function searches through the command line whether a subcommand is
already present. The first found subcommand will be printed to standard
output.
This enables us to remove code duplications from completion functions
for commands having subcommands.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
traverse_trees_recursive(): propagate merge errors up
There were few places where merge errors detected deeper in the call chain
were ignored and not propagated up the callchain to the caller.
Most notably, this caused switching branches with "git checkout" to ignore
a path modified in a work tree are different between the HEAD version and
the commit being switched to, which it internally notices but ignores it,
resulting in an incorrect two-way merge and loss of the change in the work
tree.
[PATCH] gitk: Add horizontal scrollbar to the diff view
Adding horizontal scroll bar makes the scrolling feature more
discoverable to the users. The horizontal scrollbar is a bit narrower
than vertical ones so we don't make too big impact on available screen
real estate. The text and scrollbar widget layout is done using grid
geometry manager.
An interesting side effect of Tk scrollbars is that the "elevator"
size changes depending on the visible content. So the horizontal
scrollbar "elevator" changes as the user scrolls the view up and down.
Signed-off-by: Pekka Kaitaniemi <kaitanie@cc.helsinki.fi> Signed-off-by: Paul Mackerras <paulus@samba.org>
Whenever a commit is selected in the graph pane, its SHA1 is
automatically put into the selection buffer for cut and paste.
However, some users may find this behavior annoying since it can
overwrite something they actually wanted to keep in the buffer.
This makes the behavior optional under the name "Auto-select SHA1",
but continues to default to "on".
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
[PATCH] Add an --argscmd flag to get the list of refs to show
This allows gitk to be used to display a different set of refs each
the display is refreshed. This is useful when gitk is called from
other porcelain suites, for doing such things as displaying the set of
patches in a patch stack.
The user specifies a command as the argument to the --argscmd option.
The command is run initially and each time the display is refreshed,
and is expected to generate a list of commit IDs, one per line. Those
commits are appended to the commits passed on the command-line when
constructing the git log command to be executed.
The command is considered to be an attribute of a view, and has its
own field in the saved view, and an edit field in the view editor.
Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk: Only restore window size from ~/.gitk, not position
This also limits the window size to the screen size. That is better
than nothing, but it isn't perfect, since ideally we would take into
account window decorations, and things such as gnome panels or the
Mac OS X dock and menu bar, but I don't know how to do that.
On Cygwin this is as good as restoring the whole geometry (size and
position) at working around the Cygwin Tk bugs, according to Mark
Levedahl.
Tested-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
unpack_trees(): minor memory leak fix in unused destination index
This adds a "discard_index(&o->result)" to the failure path, to reclaim
memory from an in-core index we built but ended up not using.
The *big* memory leak comes from the fact that we leak the cache_entry
things left and right. That's a very traditional and deliberate leak:
because we used to build up the cache entries by just mapping them
directly in from the index file (and we emulate that in modern times
by allocating them from one big array), we can't actually free them
one-by-one.
So doing the "discard_index()" will free the hash tables etc, which is
good, and it will free the "istate->alloc" but that is never set on the
result because we don't get the result from the index read. So we don't
actually free the individual cache entries themselves that got created
from the trees.
That's not something new, btw. We never did. But some day we should just
add a flag to the cache_entry() that it's a "free one by one" kind, and
then we could/should do it. In the meantime, this one-liner will fix
*some* of the memory leaks, but not that old traditional one.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make 'unpack_trees()' have a separate source and destination index
We will always unpack into our own internal index, but we will take the
source from wherever specified, and we will optionally write the result
to a specified index (optionally, because not everybody even _wants_ any
result: the index diffing really wants to just walk the tree and index
in parallel).
This ends up removing a fair number more lines than it adds, for the
simple reason that we can now skip all the crud that tried to be
oh-so-careful about maintaining our position in the index as we were
traversing and modifying it. Since we don't actually modify the source
index any more, we can just update the 'o->pos' pointer without worrying
about whether an index entry got removed or replaced or added to.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make 'unpack_trees()' take the index to work on as an argument
This is just a very mechanical conversion, and makes everybody set it to
'&the_index' before calling, but at least it makes it more explicit
where we work with the index.
The next stage would be to split that index usage up into a 'source' and
a 'destination' index, so that we can unpack into a different index than
we started out from.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add 'const' where appropriate to index handling functions
This is in an effort to make the source index of 'unpack_trees()' as
being const, and thus making the compiler help us verify that we only
access it for reading.
The constification also extended to some of the hashing helpers that get
called indirectly.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Fix tree-walking compare_entry() in the presense of --prefix
When we make the "root" tree-walk info entry have a pathname in it, we
need to have a ->prev pointer so that compare_entry will actually notice
and traverse into the root.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Move 'unpack_trees()' over to 'traverse_trees()' interface
This not only deletes more code than it adds, it gets rid of a
singularly hard-to-understand function (unpack_trees_rec()), and
replaces it with a set of smaller and simpler functions that use the
generic tree traversal mechanism to walk over one or more git trees in
parallel.
It's still not the most wonderful interface, and by no means is the new
code easy to understand either, but it's at least a bit less opaque.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make 'traverse_trees()' traverse conflicting DF entries in parallel
This makes the traverse_trees() entry comparator routine use the more
relaxed form of name comparison that considers files and directories
with the same name identical.
We pass in a separate mask for just the directory entries, so that the
callback routine can decide (if it wants to) to only handle one or the
other type, but generally most (all?) users are expected to really want
to see the case of a name 'foo' showing up in one tree as a file and in
another as a directory at the same time.
In particular, moving 'unpack_trees()' over to use this tree traversal
mechanism requires this.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This allows the callback to return an error value, but it can also
specify which of the tree entries that it actually used up by returning
a positive mask value.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make 'traverse_tree()' use linked structure rather than 'const char *base'
This makes the calling convention a bit less obvious, but a lot more
flexible. Instead of allocating and extending a new 'base' string, we
just link the top-most name into a linked list of the 'info' structure
when traversing a subdirectory, and we can generate the basename by
following the list.
Perhaps even more importantly, the linked list of info structures also
gives us a place to naturally save off other information than just the
directory name.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This new helper is identical to base_name_compare(), except it compares
conflicting directory/file entries as equal in order to help handling DF
conflicts (thus the name).
Note that while a directory name compares as equal to a regular file
with the new helper, they then individually compare _differently_ to a
filename that has a dot after the basename (because '\0' < '.' < '/').
So a directory called "foo/" will compare equal to a file "foo", even
though "foo.c" will compare after "foo" and before "foo/"
This will be used by routines that want to traverse the git namespace
but then handle conflicting entries together when possible.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* ph/parseopt:
parse-options: new option type to treat an option-like parameter as an argument.
parse-opt: bring PARSE_OPT_HIDDEN and NONEG to git-rev-parse --parseopt
* dp/clean-fix:
git-clean: add tests for relative path
git-clean: correct printing relative path
Make private quote_path() in wt-status.c available as quote_path_relative()
Revert part of d089eba (setup: sanitize absolute and funny paths in get_pathspec())
Revert part of 1abf095 (git-add: adjust to the get_pathspec() changes)
Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)
get_pathspec(): die when an out-of-tree path is given
* sp/fetch-optim:
Teach git-fetch to exploit server side automatic tag following
Teach fetch-pack/upload-pack about --include-tag
git-pack-objects: Automatically pack annotated tags if object was packed
Teach git-fetch to grab a tag at the same time as a commit
Make git-fetch follow tags we already have objects for sooner
Teach upload-pack to log the received need lines to an fd
Free the path_lists used to find non-local tags in git-fetch
Allow builtin-fetch's find_non_local_tags to append onto a list
Ensure tail pointer gets setup correctly when we fetch HEAD only
Remove unnecessary delaying of free_refs(ref_map) in builtin-fetch
Remove unused variable in builtin-fetch find_non_local_tags