1
0
mirror of https://github.com/git/git.git synced 2024-10-03 22:11:41 +02:00
Commit Graph

12255 Commits

Author SHA1 Message Date
Mike Hommey
1981820be2 Make git-blame fail when working tree is needed and we're not in one
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:57 -08:00
Mike Hommey
271bb08735 Don't always require working tree for git-rm
This allows to do git rm --cached -r directory, instead of
git ls-files -z directory | git update-index --remove -z --stdin.
This can be particularly useful for git-filter-branch users.

Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:57 -08:00
Mike Hommey
7d8ae93292 Use setup_work_tree() in builtin-ls-files.c
Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:57 -08:00
Mike Hommey
59f0f2f33a Refactor working tree setup
Create a setup_work_tree() that can be used from any command requiring
a working tree conditionally.

Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:57 -08:00
Johannes Sixt
4c324c0050 upload-pack: Use finish_{command,async}() instead of waitpid().
upload-pack spawns two processes, rev-list and pack-objects, and carefully
monitors their status so that it can report failure to the remote end.
This change removes the complicated procedures on the grounds of the
following observations:

- If everything is OK, rev-list closes its output pipe end, upon which
  pack-objects (which reads from the pipe) sees EOF and terminates itself,
  closing its output (and error) pipes. upload-pack reads from both until
  it sees EOF in both. It collects the exit codes of the child processes
  (which indicate success) and terminates successfully.

- If rev-list sees an error, it closes its output and terminates with
  failure. pack-objects sees EOF in its input and terminates successfully.
  Again upload-pack reads its inputs until EOF. When it now collects
  the exit codes of its child processes, it notices the failure of rev-list
  and signals failure to the remote end.

- If pack-objects sees an error, it terminates with failure. Since this
  breaks the pipe to rev-list, rev-list is killed with SIGPIPE.
  upload-pack reads its input until EOF, then collects the exit codes of
  the child processes, notices their failures, and signals failure to the
  remote end.

- If upload-pack itself dies unexpectedly, pack-objects is killed with
  SIGPIPE, and subsequently also rev-list.

The upshot of this is that precise monitoring of child processes is not
required because both terminate if either one of them dies unexpectedly.
This allows us to use finish_command() and finish_async() instead of
an explicit waitpid(2) call.

The change is smaller than it looks because most of it only reduces the
indentation of a large part of the inner loop.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:28 -08:00
Johannes Schindelin
620a6cd42e builtin-reset: avoid forking "update-index --refresh"
Instead of forking update-index, call refresh_cache() directly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:22 -08:00
Johannes Schindelin
cdf4a751fa builtin-reset: do not call "ls-files --unmerged"
Since reset is a builtin now, it can use the full power of libgit.a
and check for unmerged entries itself.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:47:22 -08:00
Johannes Schindelin
243e0614e0 parse-options: abbreviation engine fix.
When an option could be an ambiguous abbreviation of two options, the code
used to error out.  Even if an exact match would have occured later.

Test and original patch by Pierre Habouzit.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:46:45 -08:00
Junio C Hamano
fe61935007 Merge branch 'maint'
* maint:
  Remove a couple of duplicated include
  grep with unmerged index
  git-daemon: fix remote port number in log entry
  git-svn: t9114: verify merge commit message in test
  git-svn: fix dcommit clobbering when committing a series of diffs
2007-11-05 22:03:47 -08:00
Steffen Prohaska
a1f611d5d0 Fix comment in strbuf.h to use correct name strbuf_avail()
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 21:09:39 -08:00
Marco Costalba
d8e21ba896 Remove a couple of duplicated include
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 20:50:38 -08:00
Junio C Hamano
b67a43bb8f grep with unmerged index
We called flush_grep() every time we saw an unmerged entry in
the index.  If we happen to find an unmerged entry before we saw
more than two paths, we incorrectly declared that the user had
too many non-paths options in front.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 18:57:58 -08:00
Junio C Hamano
62c666a703 Merge branch 'gp/maint-diffdoc' into maint
* gp/maint-diffdoc:
  git-diff.txt: add section "output format" describing the diff formats
2007-11-05 18:56:55 -08:00
David Symonds
6eea60f85e Rearrange git-format-patch synopsis to improve clarity.
Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 18:52:16 -08:00
Pierre Habouzit
9b3beb5812 Some better parse-options documentation.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 18:47:01 -08:00
Gerrit Pape
c67359be45 git-daemon: fix remote port number in log entry
The port number in struct sockaddr_in needs to be converted from network
byte order to host byte order (on some architectures).

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 18:39:18 -08:00
Junio C Hamano
0aab4abdd4 gc: --prune prunes unreferenced objects.
Brandon Casey correctly points out that we repack with -A without --prune
and with -a with --prune, so it is not just unreferenced loose objects
that are pruned away when the option is given.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 16:39:00 -08:00
Brian Gernhardt
9f12bec438 t3502: Disambiguate between file and rev by adding --
On a case insensitive file system, this test fails because git-diff
doesn't know if it is asking for the file "A" or the tag "a".

Adding "--" at the end of the ambiguous commands allows the test to
finish properly.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 15:04:57 -08:00
Shawn Bohrer
ae3e76c299 Add more tests for git-clean
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 13:42:35 -08:00
Daniel Barkalow
378c4832ef Use parseopts in builtin-push
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 13:27:35 -08:00
Eric Wong
fb159580a1 git-svn: t9114: verify merge commit message in test
It's possible that we end up with an incorrect commit message
in this test after making changes to fix the clobber bug
in dcommit.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:58:39 -08:00
Eric Wong
c74d9acf20 git-svn: fix dcommit clobbering when committing a series of diffs
Our revision number sent to SVN is set to the last revision we
committed if we've made any previous commits in a dcommit
invocation.

Although our SVN Editor code uses the delta of two (old) trees
to generate information to send upstream, it'll still send
complete resultant files upstream; even if the tree they're
based against is out-of-date.

The combination of sending a file that does not include the
latest changes, but set with a revision number of a commit we
just made will cause SVN to accept the resultant file even if it
was generated against an old tree.

More trouble was caused when fixing this because we were
rebasing uncessarily at times.  We used git-diff-tree to check
the imported SVN revision against our HEAD, not the last tree we
committed to SVN.  The unnecessary rebasing caused merge commits
upstream to SVN to fail.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:57:34 -08:00
Nicolas Pitre
ec640ed1cf remove dead code from the csum-file interface
The provided name argument is always constant and valid in every
caller's context, so no need to have an array of PATH_MAX chars to copy
it into when a simple pointer will do.  Unfortunately that means getting
rid of wascally wabbits too.

The 'error' field is also unused.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:55:33 -08:00
Pierre Habouzit
9ef4272bea git-fetch: be even quieter.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:53:14 -08:00
Nicolas Pitre
218558af59 make display of total transferred more accurate
The throughput display needs a delay period before accounting and
displaying anything.  Yet it might be called after some amount of data
has already been transferred.  The display of total data is therefore
accounted late and therefore smaller than the reality.

Let's call display_throughput() with an absolute amount of transferred
data instead of a relative number, and let the throughput code find the
relative amount of data by itself as needed.  This way the displayed
total is always exact.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:53:14 -08:00
Nicolas Pitre
0d8aafd252 sideband.c: ESC is spelled '\033' not '\e' for portability.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 12:53:14 -08:00
Johannes Schindelin
93fc05eb9e Split off the pretty print stuff into its own file
The file commit.c got quite large, but it does not have to be: the
code concerning pretty printing is pretty well contained.  In fact,
this commit just splits it off into pretty.c, leaving commit.c with
just 672 lines.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 11:52:14 -08:00
Johannes Sixt
c2015b3ae0 Fix an infinite loop in sq_quote_buf().
sq_quote_buf() treats single-quotes and exclamation marks specially, but
it incorrectly parsed the input for single-quotes and backslashes.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04 15:16:59 -08:00
Junio C Hamano
562ca192f9 clean: require -f to do damage by default
This makes the clean.requireForce configuration default to true.
Too many people are burned by typing "git clean" by mistake when
they meant to say "make clean".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04 01:54:41 -08:00
Brian Gernhardt
e90ecb6817 format-patch: Test --[no-]numbered and format.numbered
Just because there wasn't a test for --numbered isn't a good reason
not to test format.numbered.  So now we test both.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04 01:26:30 -08:00
Brian Gernhardt
49604a4d62 format-patch: Add configuration and off switch for --numbered
format.numbered is a tri-state variable.  Boolean values enable or
disable numbering by default and "auto" enables number when outputting
more than one patch.

--no-numbered (short: -N) will disable numbering.

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04 01:26:30 -08:00
Nicolas Pitre
ebe8fa738d fix display overlap between remote and local progress
It is possible for the remote summary line to be displayed over the
local progress display line, and therefore that local progress gets
bumped to the next line.  However, if the progress line is long enough,
it might not be entirely overwritten by the remote summary line.  This
creates a messed up display such as:

	remote: Total 310 (delta 160), reused 178 (delta 112)iB/s
	Receiving objects: 100% (310/310), 379.98 KiB | 136 KiB/s, done.

So we have to clear the screen line before displaying the remote message
to make sure the local progress is not visible anymore on the first
line.

Yet some Git versions on the remote side might be sending updates to the
same line and terminate it with \r, and a separate packet with a single
\n might be sent later when the progress display is done.  This means
the screen line must *not* be cleared in that case.

Since the sideband code already has to figure out line breaks in the
received packet to properly prepend the "remote:" prefix, we can easily
determine if the remote line about to be displayed is empty.  Only when
it is not then a proper suffix is inserted before the \r or \n to clear
the end of the screen line.

Also some magic constants related to the prefix length have been
replaced with a variable, making it similar to the suffix length
handling.  Since gcc is smart enough to detect that the variable is
constant there is no impact on the generated code.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-04 01:56:53 -07:00
Junio C Hamano
140dd77a5c Merge branch 'jc/format-patch-encoding'
* jc/format-patch-encoding:
  test format-patch -s: make sure MIME content type is shown as needed
  format-patch -s: add MIME encoding header if signer's name requires so
2007-11-04 01:28:46 -07:00
Junio C Hamano
02273fdbd0 Merge branch 'jc/revert-merge'
* jc/revert-merge:
  cherry-pick/revert -m: add tests
  revert/cherry-pick: work on merge commits as well

Conflicts:

	builtin-revert.c
2007-11-04 01:26:02 -07:00
Junio C Hamano
c8a140fee4 Merge branch 'ss/mailsplit'
* ss/mailsplit:
  Make mailsplit and mailinfo strip whitespace from the start of the input
2007-11-04 01:17:50 -07:00
Junio C Hamano
e091653951 Merge branch 'np/pack'
* np/pack:
  pack-objects: get rid of an ugly cast
  make the pack index version configurable

Conflicts:

	builtin-pack-objects.c
2007-11-04 01:11:17 -07:00
Junio C Hamano
2dfffd3e09 Merge branch 'jn/gitweb'
* jn/gitweb:
  gitweb: Use config file for repository description and URLs
  gitweb: Read repo config using 'git config -z -l'
  gitweb: Add tests for overriding gitweb config with repo config
  gitweb: Use href(-replay=>1, action=>...) to generate alternate views
  gitweb: Use href(-replay=>1, page=>...) to generate pagination links
  gitweb: Easier adding/changing parameters to current URL
  gitweb: Remove CGI::Carp::set_programname() call from t9500 gitweb test
  gitweb: Add 'status_str' to parse_difftree_raw_line output
  gitweb: Always set 'from_file' and 'to_file' in parse_difftree_raw_line
2007-11-04 01:10:08 -07:00
Junio C Hamano
33e12acafe Merge branch 'np/fetch'
* np/fetch:
  git-fetch: more terse fetch output
2007-11-04 01:06:48 -07:00
Junio C Hamano
2515f935b9 Merge branch 'maint'
* maint:
  RelNotes-1.5.3.5: fix typo
  Delay pager setup in git blame
  git-cvsimport: really convert underscores in branch names to dots with -u
2007-11-03 23:50:54 -07:00
Johannes Schindelin
2e7a9785c2 git-reset: do not be confused if there is nothing to reset
The purpose of the function update_index_from_diff() (which is the
callback function we give do_diff_cache()) is to update those index
entries which differ from the given commit.

Since do_diff_cache() plays games with the in-memory index, this function
discarded the cache and reread it.

Then, back in the function read_from_tree() we wrote the index.

Of course, this broke down when there were no changes and
update_index_from_diff() was not called, and therefore the mangled index
was not discarded.

The solution is to move the index writing into the function
update_index_from_diff().

Noticed by Björn Steinbrink.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:44:57 -07:00
Heikki Orsila
19391c371c git-clone: honor "--" to end argument parsing
Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
2007-11-03 21:44:13 -07:00
David D Kilzer
ee787400de RelNotes-1.5.3.5: fix typo
Signed-off-by: David D Kilzer <ddkilzer@kilzer.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:43:58 -07:00
Benoit Sigoure
aa807bc266 git-svn: sort the options in the --help message.
"git svn <cmd> --help" gave options in the order they were found in a
Perl hash, which meant "randomly" to humans.

Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:39:12 -07:00
Steven Grimm
4b7bbdd14c builtin-fetch: Add "-q" as a synonym for "--quiet"
"-q" is the very first option described in the git-fetch manpage, and it
isn't supported.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:37:30 -07:00
Mike Hommey
b92565dc5c Delay pager setup in git blame
This avoids to launch the pager when git blame fails for any reason.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:31:37 -07:00
Gerrit Pape
a0554224a2 git-cvsimport: really convert underscores in branch names to dots with -u
The documentation states for the -u option that underscores in tag and
branch names are converted to dots, but this was actually implemented
for the tag names only.

Kurt Roeckx reported this through
 http://bugs.debian.org/446495

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:31:22 -07:00
J. Bruce Fields
00ae82895e errors: "strict subset" -> "ancestor"
The term "ancestor" is a bit more intuitive (and more consistent with
the documentation) than the term "strict subset".

Also, remove superfluous "ref", capitalize, and add some carriage
returns, changing:

    error: remote 'refs/heads/master' is not a strict subset of local ref 'refs/heads/master'. maybe you are not up-to-date and need to pull first?
    error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'

to:

    error: remote 'refs/heads/master' is not an ancestor of
    local 'refs/heads/master'.
    Maybe you are not up-to-date and need to pull first?
    error: failed to push to 'ssh://linux-nfs.org/~bfields/exports/git.git'

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-03 21:29:18 -07:00
Nicolas Pitre
165f390250 git-fetch: more terse fetch output
This makes the fetch output much more terse and prettier on a 80 column
display, based on a consensus reached on the mailing list.  Here's an
example output:

Receiving objects: 100% (5439/5439), 1.60 MiB | 636 KiB/s, done.
Resolving deltas: 100% (4604/4604), done.
From git://git.kernel.org/pub/scm/git/git
 ! [rejected]        html -> origin/html  (non fast forward)
   136e631..f45e867  maint -> origin/maint  (fast forward)
   9850e2e..44dd7e0  man -> origin/man  (fast forward)
   3e4bb08..e3d6d56  master -> origin/master  (fast forward)
   fa3665c..536f64a  next -> origin/next  (fast forward)
 + 4f6d9d6...768326f pu -> origin/pu  (forced update)
 * [new branch]      todo -> origin/todo

Some portions of this patch have been extracted from earlier proposals
by Jeff King and Shawn Pearce.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 22:36:31 -07:00
Jakub Narebski
0e121a2cd4 gitweb: Use config file for repository description and URLs
Allow to use configuration variable gitweb.description for repository
description if there is no $GIT_DIR/description file, and multivalued
configuration variable gitweb.url for URLs of a project (to clone or
fetch from) if there is no $GIT_DIR/cloneurl file.

While repository description is shown in the projects list page, so it
is better to use file and not config variable for performance, it is I
think better to use gitweb.url for URLs (as it is shown only on
project summary page).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 18:27:36 -07:00
Jakub Narebski
b201927ac8 gitweb: Read repo config using 'git config -z -l'
Change git_get_project_config to run git-config only once per
repository, without changing its signature (its calling convention).
This means for example that it returns 'true' or 'false' when called
with second argument '--bool', and not true or false value.

Instead of calling 'git config [<type>] --get gitweb.<key>' once for
each config variable, call 'git config -z -l' only once, parsing and
saving its output to %config variable.  This makes possible to add new
per repository configuration without paying cost of forking once per
variable checked.  We can now allow repository description and
repository URLs to be stored in config file without badly affecting
gitweb performance.

For now only configuration variables for 'gitweb' section are stored.

Multiple values for single configuration variable are stored as
anonymous array reference; configuration variable with no value is
stored as undef.

Converting configuration variable values to boolean or integer value
are done in Perl.  Results differ from git-config in the fact that no
conversion error is ever raised.  For boolean values no value, 'true'
(any case) and 'false' (any case) are considered true, numbers are
true if not zero; all other values (even invalid for bool) are
considered false.  For integer values value suffix of 'k', 'm', or 'g'
following decimal number will cause the value to be multiplied by
1024, 1048576, or 1073741824; other values are returned as-is, only
whitespace stripped.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02 18:27:35 -07:00