1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 06:47:52 +01:00
Commit graph

14499 commits

Author SHA1 Message Date
Shawn Bohrer
2b6f0b0a78 git clean: Add test to verify directories aren't removed with a prefix
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-14 23:14:58 -07:00
Shawn Bohrer
f2d0df7148 git clean: Don't automatically remove directories when run within subdirectory
When git clean is run from a subdirectory it should follow the normal
policy and only remove directories if they are passed in as a pathspec,
or -d is specified.

The fix is to send len which could be shorter than ent->len because we
have stripped the trailing '/' that read_directory adds. Additionaly
match_one() was modified to allow a name[] that is not NUL terminated.
This allows us to check if the name matched the pathspec exactly
instead of recursively.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-14 23:14:58 -07:00
Mark Levedahl
f669ac0be9 git-submodule - possibly use branch name to describe a module
This changes the search logic for describing a submodule from:
- annotated tag
- any tag
- tag on a subsequent commit
- commit id

to

- annotated tag
- any tag
- tag on a subsequent commit
- local or remote branch
- commit id

The change is describing with respect to a branch before falling
back to the commit id. By itself, git-submodule will maintain submodules
as headless checkouts without ever making a local branch. In
general, such heads can always be described relative to the remote branch
regardless of existence of tags, and so provides a better fallback
summary than just the commit id.

This requires inserting an extra describe step as --contains is
incompatible with --all, but the latter can be used with --always
to fall back to a commit ID. Also, --contains implies --tags, so the
latter is not needed.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-14 23:14:08 -07:00
Stephan Beyer
8e4c6aa1ac builtin-apply.c: use git_config_string() to get apply_default_whitespace
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-14 22:37:47 -07:00
Johannes Sixt
dd70f3dbe4 git-gui: Report less precise object estimates for database compression
On startup, git-gui warns if there are many loose objects. It does so by
saying, e.g., that there are "approximately 768 loose objects". But isn't
"768" a very accurate number? Lets say "750", which (while still being a
very precise number) sounds much more like an estimation.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-04-14 19:34:23 -04:00
Junio C Hamano
c35b0b5884 Fix git_config_bool_or_int
The earlier one botched the return value logic between config_bool and
config_bool_and_int.  The former should normalize between 0 and 1 while
the latter should give back full range of integer values.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-13 12:11:11 -07:00
Ping Yin
e5e4a7f23d builtin-status: Add tests for submodule summary
Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 20:00:45 -07:00
Ping Yin
ac8d5afca6 builtin-status: submodule summary support
This commit teaches 'git commit/status' show a new 'Modified submodules'
section, which is an output from:

  git submodule summary --cached --for-status --summary-limit <limit>

just before the 'Untracked files' section.

The <limit> is given by the config variable status.submodulesummary
to limit the submodule summary size. status.submodulesummary is a
bool/int variable with value:

  - false or 0 by default to disable the summary, or
  - positive number to limit the summary size, or
  - true or negative number to unlimit the summary size.

Also mention status.submodulesummary in the documentation.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 20:00:45 -07:00
Ping Yin
d0f64dd44d git-submodule summary: --for-status option
The --for-status option is mainly used by builtin-status/commit.
It adds 'Modified submodules:' line at top and  '# ' prefix to all
following lines.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 20:00:45 -07:00
Junio C Hamano
8fa29602d4 diff-files: mark an index entry we know is up-to-date as such
This does not make any difference when running diff-files alone, but if
you internally run run_diff_files() and then run other operations further
on the index, we do not have to run lstat(2) again on entries we already
have checked.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:42:17 -07:00
Junio C Hamano
e06c43c795 write_index(): optimize ce_smudge_racily_clean_entry() calls with CE_UPTODATE
When writing the index out, we need to check the work tree again to see if
an entry whose timestamp indicates that it could be "racily clean", in
order to smudge it if it is stat-clean but with modified contents.

However, we can skip this step for entries marked with CE_UPTODATE,
which are known to be the really clean (i.e. the one we already have
checked when we prepared the index).  This will reduce lstat(2) calls
necessary in git-status.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:42:17 -07:00
SZEDER Gábor
efb779f887 merge, pull: add '--(no-)log' command line option
These are the command line option equivalents of the 'merge.log' config
variable.

The patch also updates documentation and bash completion accordingly, and
adds a test.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor
6cd9cfefc5 fmt-merge-msg: add '--(no-)log' options and 'merge.log' config variable
These are new synonyms to the '--(no-)summary' option and the
'merge.summary' config variable, but are consistent with the soon to be
added 'merge --(no-)log' options.  The 'merge.summary' config variable and
'--(no-)summary' options are still accepted, but are advertised to be
removed in the future.

'merge.log' takes precedence over 'merge.summary' if they are both set
inconsistently.

Update documentation and tests accordingly.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor
3e6c0a3fe3 add 'merge.stat' config variable
This variable has the same effect, as 'merge.diffstat'.
Also mention it in the documentation.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor
d8abe148be merge, pull: introduce '--(no-)stat' option
This option has the same effect as '--(no-)summary' (i.e. whether to
show a diffsat at the end of the merge or not), and it is consistent
with the '--stat' option of other git commands.

Documentation, tests, and bash completion are updaed accordingly, and the
old --summary option is marked as being deprected.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor
f5a84c372f doc: moved merge.* config variables into separate merge-config.txt
Include the new file from config.txt and git-merge.txt.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
Junio C Hamano
f43e2fd43b Merge branch 'maint'
* maint:
  t7401: squelch garbage output
  Documentation/git-submodule: typofix
  Fix config key miscount in url.*.insteadOf
  Docs gitk: Explicitly mention the files that gitk uses (~/.gitk)
  Document -w option to shortlog
  bisect: report bad rev better
2008-04-12 19:17:51 -07:00
Junio C Hamano
02604e293a t7401: squelch garbage output
The script had an unconditional output done outside of test_expect_*
construct, which leaked out and contaminated the output without -v.
Squelch it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 18:57:08 -07:00
Junio C Hamano
a53f2ec617 git_config_bool_or_int()
This new function can be used by config parsers to tell if a variable
is simply set, set to 1, or set to "true".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 18:38:40 -07:00
Junio C Hamano
51836e9e12 Documentation/git-submodule: typofix
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 18:34:39 -07:00
Daniel Barkalow
60e3aba9c3 Fix config key miscount in url.*.insteadOf
Also tighten test to require it to be correct.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 15:41:24 -07:00
Junio C Hamano
d6d96f835c Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  Docs gitk: Explicitly mention the files that gitk uses (~/.gitk)
  Document -w option to shortlog
  bisect: report bad rev better
2008-04-12 15:41:19 -07:00
Clifford Caoile
e80950786c Docs gitk: Explicitly mention the files that gitk uses (~/.gitk)
gitk creates and uses ~/.gitk

Signed-off-by: Clifford Caoile <piyo@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 15:39:07 -07:00
Junio C Hamano
55ef8a4610 Document -w option to shortlog
Noticed by Fredrik Noring.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 15:38:20 -07:00
Christian Couder
a179a30352 bisect: report bad rev better
The previous one overwrote the variable used to report the bad input
when the input is actually bad, and we did not give a useful enough
information.  This corrects it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 15:16:13 -07:00
Junio C Hamano
4cdda2b895 Merge branch 'maint'
* maint:
  bisect: fix bad rev checking in "git bisect good"
  revision.c: make --date-order overriddable
  git-submodule: Avoid 'fatal: cannot describe' message
  Force the medium pretty format on calls to git log
  Fix section about backdating tags in the git-tag docs
  Document option --only of git commit
  Documentation/git-request-pull: Fixed a typo ("send" -> "end")
2008-04-11 23:56:09 -07:00
Junio C Hamano
eed81838f0 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  bisect: fix bad rev checking in "git bisect good"
  revision.c: make --date-order overriddable
  Fix section about backdating tags in the git-tag docs
  Document option --only of git commit
  Documentation/git-request-pull: Fixed a typo ("send" -> "end")
2008-04-11 23:55:55 -07:00
Christian Couder
e3389075c6 bisect: fix bad rev checking in "git bisect good"
It seems that "git bisect good" and "git bisect skip" have never
properly checked arguments that have been passed to them. As soon
as one of them can be parsed as a SHA1, no error or warning would
be given.

This is because 'git rev-parse --revs-only --no-flags "$@"' always
"exit 0" and outputs all the SHA1 it can found from parsing "$@".

This patch fix this by using, for each "bisect good" argument, the
same logic as for the "bisect bad" argument.

While at it, this patch teaches "bisect bad" to give a meaningfull
error message when it is passed more than one argument.

Note that if "git bisect good" or "git bisect skip" is given some
proper revs and then something that is not a proper rev, then the
first proper revs will still have been marked as "good" or "skip".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 23:54:45 -07:00
Christian Couder
243a60fbb5 bisect: add "git bisect help" subcommand to get a long usage string
Users are not often aware of the fact that "git bisect -h" can give
them a long usage description, as "git bisect" seems to accept only
dashless subcommands like "start", "good", ...

That's why this patch adds a "git bisect help" subcommand that just
calls "git bisect -h". This new subcommand is also fully documented
in the short usage string (that "git bisect" gives), in the long
usage string and in the man page (that "git help bisect" gives).

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 23:03:50 -07:00
Johannes Sixt
3c5283f8b1 builtin-commit.c: Remove a redundant assignment.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 23:03:50 -07:00
Michele Ballabio
a710522bfc revision.c: make --date-order overriddable
Jan Engelhardt noticed that while --topo-order can be overridden by a
subsequent --date-order, the reverse was not possible. That's because
setup_revisions() failed to set revs->lifo properly.

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 23:01:33 -07:00
Ping Yin
a68972c2ad git-submodule: Avoid 'fatal: cannot describe' message
When "git submodule status" command tries to show the name of the
submodule HEAD revision more descriptively, but the submodule
repository lacked a suitable tag to do so, it leaked "fatal: cannot
describe" message to the UI.  Squelch it by using '--always'.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 17:35:39 -07:00
Pedro Melo
b6309ac2b8 Force the medium pretty format on calls to git log
If a user has customized format.pretty in config, git-svn rebase fails with:

	Unable to determine upstream SVN information from working tree history

because the command expects to read the commit log in the default format.

This fixes the command to explicitly ask for the format it wants to read
from.

Signed-off-by: Pedro Melo <melo@simplicidade.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 17:35:35 -07:00
Björn Steinbrink
055b66158c Fix section about backdating tags in the git-tag docs
The tagger is equal to the committer, not the author, so
GIT_COMMITTER_DATE is the right environment variable to use, not
GIT_AUTHOR_DATE.

Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 17:34:05 -07:00
Johannes Sixt
d4ba07cac5 Document option --only of git commit
Its documentation was removed by 6c96753 (Documentation/git-commit: rewrite
to make it more end-user friendly, 2006-12-08), even though it is referenced
from a few places, including builtin-commit.c (as part of the commentary in
the commit message template).

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 12:54:15 -07:00
Dirk Suesserott
ca593f7959 Documentation/git-request-pull: Fixed a typo ("send" -> "end")
Signed-off-by: Dirk Suesserott <newsletter@dirk.my1.cc>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-11 12:25:30 -07:00
Matthias Kestenholz
4d4f5ba3ea Use color.ui variable in scripts too
Signed-off-by: Matthias Kestenholz <mk@spinlock.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 12:40:50 -07:00
Junio C Hamano
4da45bef56 log: teach "terminator" vs "separator" mode to "--pretty=format"
This attached patch introduces a single bit "use_terminator" in "struct
rev_info", which is normally false (i.e. most formats use separator
semantics) but by flipping it to true, you can ask for terminator
semantics just like oneline format does.

The function get_commit_format(), which is what parses "--pretty=" option,
now takes a pointer to "struct rev_info" and updates its commit_format and
use_terminator fields.  It used to return the value of type "enum
cmit_fmt", but all the callers assigned it to rev->commit_format.

There are only two cases the code turns use_terminator on.  Obviously, the
traditional oneline format (--pretty=oneline) is one of them, and the new
case is --pretty=tformat:... that acts like --pretty=format:... but flips
the bit on.

With this, "--pretty=tformat:%H %s" acts like --pretty=oneline.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 03:25:03 -07:00
Jeff King
c4112bb6bb git-remote: show all remotes with "git remote show"
Many other commands use the "no arguments" form to show a
list (e.g., git-branch, git-tag). While we did show all
remotes for just "git remote", we displayed a usage error
for "git remote show" with no arguments. This is
counterintuitive, since by giving it _more_ information, we
get _less_ result.

The usage model can now be thought of as:

  - "git remote show <remote>": show a remote
  - "git remote show": show all remotes
  - "git remote": assume "show"; i.e., shorthand for "git remote show"

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 01:37:12 -07:00
Jeff King
e5c49826d2 git-fetch: always show status of non-tracking-ref fetches
Previously, a fetch like:

  git fetch git://some/url

would show no ref status output (just the object downloading
status, if there was any), leading to some confusion.

With this patch, we now show the usual ref table, with
remote refs going into FETCH_HEAD. Previously this output
was shown only if "-v"erbose was specified.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 01:02:59 -07:00
Junio C Hamano
71349732c5 Merge branch 'maint'
* maint:
  git-fetch: fix status output when not storing tracking ref
  core-tutorial.txt: Fix showing the current behaviour.
  git-archive: ignore prefix when checking file attribute
  Fix documentation syntax of optional arguments in short options.
2008-04-10 00:47:04 -07:00
Jeff King
f59774add4 git-fetch: fix status output when not storing tracking ref
There was code in update_local_ref for handling this case,
but it never actually got called. It assumed that storing in
FETCH_HEAD meant a blank peer_ref name, but we actually have
a NULL peer_ref in this case, so we never even made it to
the update_local_ref function.

On top of that, the display formatting was different from
all of the other cases, probably owing to the fact that
nobody had ever actually seen the output.

This patch harmonizes the output with the other cases and
moves the detection of this case into store_updated_refs,
where we can actually trigger it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 00:30:44 -07:00
Junio C Hamano
179c94b24a Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  core-tutorial.txt: Fix showing the current behaviour.
  git-archive: ignore prefix when checking file attribute
  Fix documentation syntax of optional arguments in short options.
2008-04-10 00:29:33 -07:00
Carlos Rica
abea85d1e9 core-tutorial.txt: Fix showing the current behaviour.
The --root option from "git diff-tree" won't do nothing
when is given to commands like git-whatchanged or git-log,
because those always print the initial commit by default.

This fixes the tutorial explaining the function of the
log.showroot configuration variable.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 00:20:41 -07:00
René Scharfe
ac7fa2776c git-archive: ignore prefix when checking file attribute
Ulrik Sverdrup noticed that git-archive doesn't correctly apply the attribute
export-subst when the option --prefix is given, too.

When it checked if a file has the attribute turned on, git-archive would try
to look up the full path -- including the prefix -- in .gitattributes.  That's
wrong, as the prefix doesn't need to have any relation to any existing
directories, tracked or not.

This patch makes git-archive ignore the prefix when looking up if value of the
attribute export-subst for a file.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 00:20:38 -07:00
Carlos Rica
3f36cbbaaf Fix documentation syntax of optional arguments in short options.
When an argument for an option is optional, like in -n from git-tag,
puting a space between the option and the argument is interpreted
as a missing argument for the option plus an isolated argument.
Documentation now reflects the need to write the parameter following
the option -n, as in "git tag -nARG", for instance.

Signed-off-by: Carlos Rica <jasampler@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10 00:20:31 -07:00
Miklos Vajna
f949844263 contrib/hooks: add an example pre-auto-gc hook
It disables git-gc --auto when you are running Linux and you are
not on AC.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09 01:31:13 -07:00
Miklos Vajna
0b85d92661 Documentation/hooks: add pre-auto-gc hook
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09 01:31:13 -07:00
Miklos Vajna
bde3054016 git-gc --auto: add pre-auto-gc hook
If such a hook is available and exits with a non-zero status, then
git-gc --auto won't run.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09 01:31:13 -07:00
Junio C Hamano
12ecb01107 sha1-lookup: make selection of 'middle' less aggressive
If we pick 'mi' between 'lo' and 'hi' at 50%, which was what the
simple binary search did, we are halving the search space
whether the entry at 'mi' is lower or higher than the target.

The previous patch was about picking not the middle but closer
to 'hi', when we know the target is a lot closer to 'hi' than it
is to 'lo'.  However, if it turns out that the entry at 'mi' is
higher than the target, we would end up reducing the search
space only by the difference between 'mi' and 'hi' (which by
definition is less than 50% --- that was the whole point of not
using the simple binary search), which made the search less
efficient.  And the risk of overshooting becomes very high, if
we try to be too precise.

This tweaks the selection of 'mi' to be a bit closer to the
middle than we would otherwise pick to avoid the problem.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-09 01:30:18 -07:00