1
0
mirror of https://github.com/git/git.git synced 2024-09-28 15:01:31 +02:00
Commit Graph

15694 Commits

Author SHA1 Message Date
Steve Haslam
31f4e768a4 Propagate -u/--upload-pack option of "git clone" to transport.
The -u option to override the remote system's path to git-upload-pack was
being ignored by "git clone"; caused by a missing call to
transport_set_option to set TRANS_OPT_UPLOADPACK. Presumably this crept in
when git-clone was converted from shell to C.

Signed-off-by: Steve Haslam <shaslam@lastminute.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 22:49:25 -07:00
Anders Melchiorsen
bbff8aaaf2 Documentation: fix diff.external example
The diff.external examples pass a flag to gnu-diff, but GNU diff
does not follow the GIT_EXTERNAL_DIFF interface.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 22:45:27 -07:00
Junio C Hamano
b2a5627651 make sure parsed wildcard refspec ends with slash
A wildcard refspec is internally parsed into a refspec structure with src
and dst strings.  Many parts of the code assumed that these do not include
the trailing "/*" when matching the wildcard pattern with an actual ref we
see at the remote.  What this meant was that we needed to make sure not
just that the prefix matched, and also that a slash followed the part that
matched.

But a codepath that scans the result from ls-remote and finds matching
refs forgot to check the "matching part must be followed by a slash" rule.
This resulted in "refs/heads/b1" from the remote side to mistakenly match
the source side of "refs/heads/b/*:refs/remotes/b/*" refspec.

Worse, the refspec crafted internally by "git-clone", and a hardcoded
preparsed refspec that is used to implement "git-fetch --tags", violated
this "parsed widcard refspec does not end with slash" rule; simply adding
the "matching part must be followed by a slash" rule then would have
broken codepaths that use these refspecs.

This commit changes the rule to require a trailing slash to parsed
wildcard refspecs.  IOW, "refs/heads/b/*:refs/remotes/b/*" is parsed as
src = "refs/heads/b/" and dst = "refs/remotes/b/".  This allows us to
simplify the matching logic because we only need to do a prefixcmp() to
notice "refs/heads/b/one" matches and "refs/heads/b1" does not.

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 22:41:15 -07:00
Jeff King
d65d2b2fb4 init: handle empty "template" parameter
If a user passes "--template=", then our template parameter
is blank. Unfortunately, copy_templates() assumes it has at
least one character, and does all sorts of bad things like
reading from template[-1] and then proceeding to link all of
'/' into the .git directory.

This patch just checks for that condition in copy_templates
and aborts. As a side effect, this means that --template=
now has the meaning "don't copy any templates."

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 22:41:07 -07:00
Stephan Beyer
1e5f7add98 builtin-revert.c: typofix
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-01 21:10:40 -07:00
Pierre Habouzit
0fe8c13810 Allow "non-option" revision options in parse_option-enabled commands
Commands which use parse_options() but also call setup_revisions()
must do their parsing in a two step process:

  1. first, they parse all options. Anything unknown goes to
     parse_revision_opt() (which calls handle_revision_opt), which
     may claim the option or say "I don't recognize this"

  2. the non-option remainder goes to setup_revisions() to
     actually get turned into revisions

Some revision options are "non-options" in that they must be
parsed in order with their revision counterparts in
setup_revisions().  For example, "--all" functions as a
pseudo-option expanding to all refs, and "--no-walk" affects refs
after it on the command line, but not before. The revision option
parser in step 1 recognizes such options and sets them aside for
later parsing by setup_revisions().

However, the return value used from handle_revision_opt indicated
"I didn't recognize this", which was wrong. It did, and it took
appropriate action (even though that action was just deferring it
for later parsing). Thus it should return "yes, I recognized
this."

Previously, these pseudo-options generated an error when used with
parse_options parsers (currently just blame and shortlog). With
this patch, they should work fine, enabling things like "git
shortlog --all".

Signed-off-by: Jeff King <peff@peff.net>
Acked-By: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-31 11:35:17 -07:00
Junio C Hamano
b3123f9802 Teach --find-copies-harder to "git blame"
It's equivalent to "-C -C" with the diff family.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-31 11:22:12 -07:00
Jeff King
fdc7c81111 Compact commit template message
We recently let the user know explicitly that an empty
commit message will abort the commit. However, this adds yet
another line to the template; let's rephrase and re-wrap so
that this fits back on two lines.

This patch also makes the "fatal: empty commit message?"
warning a bit less scary, since this is now a "feature"
instead of an error. However, we retain the non-zero exit
status to indicate to callers that nothing was committed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-31 11:20:13 -07:00
Alexander Gavrilov
835e62aef8 gitk: Fallback to selecting the head commit upon load
Try selecting the head, if the previously selected commit
is not available in the new view.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Alexander Gavrilov
567c34e0ed gitk: Fixed automatic row selection during load
- Switching views now actually preserves the selected commit.
- Reloading (also Edit View) preserves the currently selected commit.
- Initial selection does not produce weird scrolling.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Alexander Gavrilov
7272131b3e gitk: Fixed broken exception handling in diff
If the tree diff command failed to start for some
random reason, treepending remained set, and thus
no more diffs were shown after that.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Alexander Gavrilov
b6326e92ef gitk: On Windows, use a Cygwin-specific flag for kill
MSysGit compiles git binaries as native Windows executables,
so they cannot be killed unless a special flag is specified.

This flag is implemented by the Cygwin version of kill,
which is also included in MSysGit.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Alexander Gavrilov
e439e092b8 gitk: Arrange to kill diff-files & diff-index on quit
Local change analysis can take a noticeable amount of time on large
file sets, and produce no output if there are no changes.  Register
the back-ends in commfd, so that they get properly killed on window
close.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Alexander Gavrilov
e2f90ee45c gitk: Kill back-end processes on window close
When collecting commits for a rarely changed, or recently
created file or directory, rev-list may work for a noticeable
period of time without producing any output.  Such processes
don't receive SIGPIPE for a while after gitk is closed, thus
becoming runaway CPU hogs.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-31 20:29:44 +10:00
Abhijit Menon-Sen
f448e24e2f Make the DESCRIPTION match <x>... items in the SYNOPSIS
When the SYNOPSIS says e.g. "<path>...", it is nice if the DESCRIPTION
also mentions "<path>..." and says the specified "paths" (note plural)
are used for $whatever. This fixes the obvious mismatches.

Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 21:42:55 -07:00
Christian Couder
0e25790f1d documentation: user-manual: update "using-bisect" section
Since version 1.5.6 "git bisect" doesn't use a "bisect" branch any
more, but the user manual had not been updated to reflect this.

So this patch does that and while at it also adds a few words about
"git bisect skip" and points user to the "git bisect" man page for
more information.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 21:42:20 -07:00
Junio C Hamano
c4aca9ccda Fix test-parse-options "integer" test
OPT_INTEGER() works on an integer, not on an unsigned long.  On a big
endian architecture with long larger than int, integer test gives bogus
results because of this bug.

Reported by H.Merijn Brand in HP-UX 64-bit environment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 12:53:45 -07:00
Todd Zullinger
5354a56fe7 Replace uses of "git-var" with "git var"
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 11:42:01 -07:00
Junio C Hamano
9b6bf4d575 Fix merge name generation in "merge in C"
When merging an early part of a branch, e.g. "git merge xyzzy~20", we were
supposed to say "branch 'xyzzy' (early part)", but it incorrectly said
"branch 'refs/heads/xy' (early part)" instead.

The logic was supposed to first strip away "~20" part to make sure that
what follows "~" is a non-zero posint, prefix it with "refs/heads/" and
ask resolve_ref() if it is a ref.  If it is, then we know xyzzy was a
branch, and we can give the correct message.

However, there were a few bugs.  First of all, the logic to build this
"true branch refname" did not count the characters correctly.  At this
point of the code, "len" is the number of trailing, non-name part of the
given extended SHA-1 expression given by the user, i.e. number of bytes in
"~20" in the above example.

In addition, the message forgot to skip "refs/heads/" it prefixed from the
output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 01:13:26 -07:00
Cesar Eduardo Barros
81b237d5db Documentation/git-rev-parse.txt: update for new git-describe output format
Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 00:19:22 -07:00
Junio C Hamano
731ab1f55e Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui:
  git-gui (Windows): Change wrapper to execdir 'libexec/git-core'
  git-gui (Windows): Switch to relative discovery of oguilib
  git-gui: Correct installation of library to be $prefix/share
  git-gui: Fix gitk search in $PATH to work on Windows
  git-gui: Preserve scroll position on reshow_diff.
  git-gui: Fix the Remote menu separator.
2008-07-30 00:18:26 -07:00
Rene Scharfe
4fac1d3a98 archive: allow --exec and --remote without equal sign
Convert git archive to parse_options().  The parameters --remote and --exec
are still handled by their special parser.  Define them anyway in order for
them to show up in the usage notice.

Note: in a command like "git archive --prefix --remote=a/ HEAD", the string
"--remote=a/" will be interpreted as a remote option, not a prefix, because
that special parser sees it first.  If one needs such a strange prefix, it
needs to be specified like this: "git archive --prefix=--remote=a/ HEAD"
(with an equal sign).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 00:15:14 -07:00
Junio C Hamano
c70115b4b1 Teach gitlinks to ie_modified() and ce_modified_check_fs()
The ie_modified() function is the workhorse for refresh_cache_entry(),
i.e. checking if an index entry that is stat-dirty actually has changes.

After running quicker check to compare cached stat information with
results from the latest lstat(2) to answer "has modification" early, the
code goes on to check if there really is a change by comparing the staged
data with what is on the filesystem by asking ce_modified_check_fs().
However, this function always said "no change" for any gitlinks that has a
directory at the corresponding path.  This made ie_modified() to miss
actual changes in the subproject.

The patch fixes this first by modifying an existing short-circuit logic
before calling the ce_modified_check_fs() function.  It knows that for any
filesystem entity to which ie_match_stat() says its data has changed, if
its cached size is nonzero then the contents cannot match, which is a
correct optimization only for blob objects.  We teach gitlink objects to
this special case, as we already know that any gitlink that
ie_match_stat() says is modified is indeed modified at this point in the
codepath.

With the above change, we could leave ce_modified_check_fs() broken, but
it also futureproofs the code by teaching it to use ce_compare_gitlink(),
instead of assuming (incorrectly) that any directory is unchanged.

Originally noticed by Alex Riesen on Cygwin.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 00:09:22 -07:00
Anders Melchiorsen
bd2574ca69 Advertise the ability to abort a commit
This treats aborting a commit more like a feature.

Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-30 00:00:02 -07:00
Alexander Gavrilov
ae7c5dcef9 Support copy and rename detection in fast-export.
Although it does not matter for Git itself, tools that
export to systems that explicitly track copies and
renames can benefit from such information.

This patch makes fast-export output correct action
logs when -M or -C are enabled.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:57:51 -07:00
Kevin Ballard
6b2fbaaffc format-patch: Produce better output with --inline or --attach
This patch makes two small changes to improve the output of --inline
and --attach.

The first is to write a newline preceding the boundary. This is needed because
MIME defines the encapsulation boundary as including the preceding CRLF (or in
this case, just LF), so we should be writing one. Without this, the last
newline in the pre-diff content is consumed instead.

The second change is to always write the line termination character
(default: newline) even when using --inline or --attach. This is simply to
improve the aesthetics of the resulting message. When using --inline an email
client should render the resulting message identically to the non-inline
version. And when using --attach this adds a blank line preceding the
attachment in the email, which is visually attractive.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:18:15 -07:00
Brian Gernhardt
8cb070a4cf Documentation: Remove mentions of git-svnimport.
git-svnimport is no longer supported, so don't mention it in the
documentation.  This also updates the description, removing the
historical discussion, since it mostly dealt with how it differed from
svnimport.  The new description gives some starting points into the
rest of the documentation.

Noticed by Jurko Gospodnetić <jurko.gospodnetic@docte.hr>

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:18:04 -07:00
Abhijit Menon-Sen
2c9693bda5 Make it clear that push can take multiple refspecs
Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:18:04 -07:00
Abhijit Menon-Sen
a56bf5850a git submodule add now requires a <path>
Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-29 23:18:04 -07:00
Steffen Prohaska
5fc6edab76 git-gui (Windows): Change wrapper to execdir 'libexec/git-core'
git-gui needs bindir in PATH to be able to run 'git'.  bindir
however is not necessarily in PATH if started directly through a
Windows shortcut.  Therefore, we used to add the directory
git-gui is located in.  But with the new 'libexec/git-core'
layout this directory is no longer identical to bindir.

This commit modifies the wrapper script to discover the bindir
and add it to PATH.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Steffen Prohaska
f57ddcc5ec git-gui (Windows): Switch to relative discovery of oguilib
Instead of using an absolute path, git-gui can discover its
gui library using a relative path from execdir.  We want to
use the relative path discovery on MinGW to avoid issues
with translation of absolute paths.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Steffen Prohaska
f8f1acf339 git-gui: Correct installation of library to be $prefix/share
We always wanted the library for git-gui to install into the
$prefix/share directory, not $prefix/libexec/share.  All of
the files in our library are platform independent and may
be reused across systems, like any other content stored in
the share directory.

Our computation of where our library should install to was broken
when git itself started installing to $prefix/libexec/git-core,
which was one level down from where we expected it to be.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:43:37 -07:00
Shawn O. Pearce
79317e5df1 git-gui: Fix gitk search in $PATH to work on Windows
Back in 15430be5a1 ("Look for gitk in $PATH, not $LIBEXEC/git-core")
git-gui learned to use [_which gitk] to locate where gitk's script
is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all
of the other tools are in $gitexecdir.

This failed on Windows because _which adds the ".exe" suffix as it
searches for the program on $PATH, under the assumption that we can
only execute something from Tcl if it is a proper Windows executable.

When scanning for gitk on Windows we need to omit the ".exe" suffix.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-29 22:41:23 -07:00
Alex Riesen
1ce4790bf5 Make use of stat.ctime configurable
A new configuration variable 'core.trustctime' is introduced to
allow ignoring st_ctime information when checking if paths
in the working tree has changed, because there are situations where
it produces too much false positives.  Like when file system crawlers
keep changing it when scanning and using the ctime for marking scanned
files.

The default is to notice ctime changes.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:26:25 -07:00
Christian Couder
df57accb46 merge-base: die with an error message if not passed a commit ref
Before this patch "git merge-base" just exited with error code 1
and without an error message in case it was passed a ref to an
object that is not a commit (for example a tree).

This patch makes it "die" in this case with an error message.

While at it, this patch also refactors the code to get the
commit reference from an argument into a new
"get_commit_reference" function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:12 -07:00
Junio C Hamano
65c35b2256 t7001: fix "git mv" test
The test assumed that we can keep the cached stat information fresh across
rename(2); many filesystems however update st_ctime (and POSIX allows them
to do so), and that assumption does not hold.

We can explicitly refresh the index for the purpose of these tests.  The
only thing we are interested in is the staged contents and the mode bits
are preserved across "git mv".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:12 -07:00
Junio C Hamano
c297432d0d Documentation: clarify what is shown in "git-ls-files -s" output
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:11 -07:00
Steffen Prohaska
108ac313f7 run-command (Windows): Run dashless "git <cmd>"
We prefer running the dashless form, and POSIX side already does so; we
should use it in MinGW's start_command(), too.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:11 -07:00
Steffen Prohaska
4933e5ebde Refactor, adding prepare_git_cmd(const char **argv)
prepare_git_cmd(const char **argv) adds a first entry "git" to
the array argv.  The new array is allocated on the heap.  It's
the caller's responsibility to release it with free().  The code
was already present in execv_git_cmd() but could not be used from
outside.  Now it can also be called for preparing the command list
in the MinGW codepath in run-command.c.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:11 -07:00
Olivier Marin
d276189514 builtin-verify-tag: fix -v option parsing
Since the C rewrite, "git verify-tag -v" just does nothing instead of
printing the usage message with an error. This patch fix the regression.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:02:11 -07:00
Junio C Hamano
7ddea13af2 ls-tree documentation: enhance notes on subdirectory and pathspec behaviour
When run in a working copy subdirectory, git-ls-tree will automagically
add the prefix to the pathspec, which can result in an unexpected behavior
when the tree object accessed is not the root tree object.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 23:01:57 -07:00
Junio C Hamano
1b65f38c06 Allow installing in the traditional way
In an earlier commit c70a8d9 (Makefile: Do not install a copy of 'git' in
$(gitexecdir), 2008-07-21), we tried to avoid installing two git, one in
/usr/bin/git and the other in /usr/libexec/git-core/git.  It mistakenly
removed the only copy of git when gitexecdir and bindir are set to the
same directory, i.e. the traditional layout.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 13:09:54 -07:00
Junio C Hamano
e84a063da8 Allow building without any git installed
This is a follow-up patch to 49fa65a (Allow the built-in exec path to be
relative to the command invocation path, 2008-07-23).  Without specific
gitexecdir passed from the command line, git-gui's build procedure would
try to figure out the value for it by running an installed git.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-28 13:09:54 -07:00
Jeff King
172035f044 init: handle empty "template" parameter
If a user passes "--template=", then our template parameter
is blank. Unfortunately, copy_templates() assumes it has at
least one character, and does all sorts of bad things like
reading from template[-1] and then proceeding to link all of
'/' into the .git directory.

This patch just checks for that condition in copy_templates
and aborts. As a side effect, this means that --template=
now has the meaning "don't copy any templates."

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 23:14:03 -07:00
Junio C Hamano
8e1db3871c GIT 1.6.0-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.6.0-rc1
2008-07-27 15:07:56 -07:00
Petr Baudis
81dc2307d0 git-mv: Keep moved index entries inact
The rewrite of git-mv from a shell script to a builtin was perhaps
a little too straightforward: the git add and git rm queues were
emulated directly, which resulted in a rather complicated code and
caused an inconsistent behaviour when moving dirty index entries;
git mv would update the entry based on working tree state,
except in case of overwrites, where the new entry would still have
sha1 of the old file.

This patch introduces rename_index_entry_at() into the index toolkit,
which will rename an entry while removing any entries the new entry
might render duplicate. This is then used in git mv instead
of all the file queues, resulting in a major simplification
of the code and an inevitable change in git mv -n output format.

Also the code used to refuse renaming overwriting symlink with a regular
file and vice versa; there is no need for that.

A few new tests have been added to the testsuite to reflect this change.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 15:05:19 -07:00
Petr Baudis
f6c52fe4e8 git-mv: Remove dead code branch
The path list builder had a branch for the case the source is not in index, but
this can happen only if the source was a directory. However, in that case we
have already expanded the list to the directory contents and set mode
to WORKING_DIRECTORY, which is tested earlier.

The patch removes the superfluous branch and adds an assert() instead. git-mv
testsuite still passes.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 15:05:19 -07:00
Shawn O. Pearce
a08c53a119 fsck: Don't require tmp_obj_ file names are 14 bytes in length
Not all temporary file creation routines will ensure 14 bytes are
used to generate the temporary file name.  In C Git this may be
true, but alternate implementations such as jgit are not always
able to generate a temporary file name with a specific prefix and
also ensure the file name length is 14 bytes long.

Since temporary files in a directory we are fsck'ing should be
uncommon (as they are short lived only long enough for an active
writer to finish writing the file and rename it) we shouldn't see
these show up very often.  Always using a prefixcmp() call and
ignoring the length opens up room for other implementations to use
different name generation schemes.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:49:26 -07:00
Johannes Schindelin
f5d600e2dd Avoid chdir() in list_commands_in_dir()
The function list_commands_in_dir() tried to be lazy and just chdir()
to the directory which entries it listed, so that the check if the
file is executable could be done on dir->d_name.

However, there is no good reason to jump around wildly just to find
all Git commands.

Instead, have a strbuf and construct the full path dynamically.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:14:38 -07:00
Lars Hjemli
b6f637d199 builtin-branch: fix -v for --[no-]merged
After the optimization to --[no-]merged logic, the calculation of the
width of the longest refname to be shown might become inaccurate (since
the matching against merge_filter is performed after adding refs to
ref_list). This patch forces a recalculation of maxwidth when it might
be needed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:14:01 -07:00