Commit Graph

12962 Commits

Author SHA1 Message Date
Junio C Hamano
a6214fe06e Merge branch 'jk/maint-cvsimport-fix' into maint
* jk/maint-cvsimport-fix:
  cvsimport: miscellaneous packed-ref fixes
  cvsimport: use rev-parse to support packed refs
  Add basic cvsimport tests
2007-11-30 14:22:54 -08:00
Johannes Sixt
fdd7d48d6a t7003-filter-branch: Fix test of a failing --msg-filter.
The test passed for the wrong reason: If the script given to --msg-filter
fails, it is expected that git-filter-branch aborts. But the test forgot
to tell the branch name to rewrite, and so git-filter-branch failed due to
incorrect usage.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 14:16:52 -08:00
David Symonds
0d8135891e Mention that git-rm can be an appropriate resolution as well as git-add.
Especially when using git-cherry-pick, removing files that are unmerged can be
a logical action. This patch merely changes the informative text to be less
confusing.

Signed-off-by: David Symonds <dsymonds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 14:15:08 -08:00
Wincent Colaiuta
804c7174c9 revert/cherry-pick: Allow overriding the help text by the calling Porcelain
A Porcelain command that uses cherry-pick or revert may make a commit
out of resolved index itself, in which case telling the user to commit
the result is not appropriate at all.  This allows GIT_CHERRY_PICK_HELP
environment variable to be set by the calling Porcelain in order to
override the built-in help text.

[jc: this is heavily modified from the original but should be equivalent
 in spirit]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 13:55:49 -08:00
Jakub Narebski
346d203bc3 Add config_int() method to the Git perl module
Integer variables can have optional 'k', 'm' or 'g' suffix.
config_int() method will return simple decimal number, taking
care of those suffixes.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 13:52:36 -08:00
André Goddard Rosa
d6617c7cde Error out when user doesn't have access permission to the repository
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
2007-11-30 13:10:11 -08:00
Wincent Colaiuta
14cb50382c Highlight keyboard shortcuts in git-add--interactive
The user interface provided by the command loop in git-add--interactive
gives the impression that subcommands can only be launched by entering
an integer identifier from 1 through 8.

A "hidden" feature is that any string can be entered, and a regex search
anchored at the beginning of the string is used to find the uniquely
matching option.

This patch makes this feature a little more obvious by highlighting the
first character of each subcommand (for example "patch" is displayed as
"[p]atch").

A new function is added to detect the shortest unique prefix and this
is used to decide what to highlight. Highlighting is also applied when
choosing files.

In the case where the common prefix may be unreasonably large
highlighting is omitted; in this patch the soft limit (above which the
highlighting will be omitted for a particular item) is 0 (in other words,
there is no soft limit) and the hard limit (above which highlighting will
be omitted for all items) is 3, but this can be tweaked.

The actual highlighting is done by the highlight_prefix function, which
will enable us to implement ANSI color code-based highlighting (most
likely using underline or boldface) in the future.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-30 12:37:40 -08:00
Junio C Hamano
63d285c849 per-directory-exclude: lazily read .gitignore files
Operations that walk directories or trees, which potentially need to
consult the .gitignore files, used to always try to open the .gitignore
file every time they entered a new directory, even when they ended up
not needing to call excluded() function to see if a path in the
directory is ignored.  This was done by push/pop exclude_per_directory()
functions that managed the data in a stack.

This changes the directory walking API to remove the need to call these
two functions.  Instead, the directory walk data structure caches the
data used by excluded() function the last time, and lazily reuses it as
much as possible.  Among the data the last check used, the ones from
deeper directories that the path we are checking is outside are
discarded, data from the common leading directories are reused, and then
the directories between the common directory and the directory the path
being checked is in are checked for .gitignore file.  This is very
similar to the way gitattributes are handled.

This API change also fixes "ls-files -c -i", which called excluded()
without setting up the gitignore data via the old push/pop functions.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-29 02:19:14 -08:00
Junio C Hamano
686a4a06b6 dir.c: minor clean-up
Replace handcrafted reallocation with ALLOC_GROW().
Reindent "file_exists()" helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-29 01:11:46 -08:00
Johannes Schindelin
ecfe72ff65 rebase -i: give rerere a chance
Like non-interactive rebase, interactive mode now calls rerere when
appropriate.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 17:57:28 -08:00
Junio C Hamano
9ce0352258 git-config --get-color: get configured color
This new option allows scripts to grab color setting from the user
configuration, translated to ANSI color escape sequence.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 17:33:17 -08:00
Junio C Hamano
57f2b8424a "color.diff = true" is not "always" anymore.
Too many people got burned by setting color.diff and color.status to
true when they really should have set it to "auto".

This makes only "always" to do the unconditional colorization, and
change the meaning of "true" to the same as "auto": colorize only when
we are talking to a terminal.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 17:33:17 -08:00
Johannes Schindelin
cd67e4d46b Teach 'git pull' about --rebase
When calling 'git pull' with the '--rebase' option, it performs a
fetch + rebase instead of a fetch + merge.

This behavior is more desirable than fetch + pull when a topic branch
is ready to be submitted and needs to be update.

fetch + rebase might also be considered a better workflow with shared
repositories in any case, or for contributors to a centrally managed
repository, such as WINE's.

As a convenience, you can set the default behavior for a branch by
defining the config variable branch.<name>.rebase, which is
interpreted as a bool.  This setting can be overridden on the command
line by --rebase and --no-rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 17:32:23 -08:00
Johannes Schindelin
3addc94aff Replace instances of export VAR=VAL with VAR=VAL; export VAR
It might be POSIX, but there are shells that do not like the
expression 'export VAR=VAL'.  To be on the safe side, rewrite them
into 'VAR=VAL' and 'export VAR'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 17:23:18 -08:00
Junio C Hamano
d25430c5f8 Merge branch 'maint'
* maint:
  scripts: do not get confused with HEAD in work tree
  Improve description of git-branch -d and -D in man page.
2007-11-28 17:06:57 -08:00
Junio C Hamano
38762c47d6 scripts: do not get confused with HEAD in work tree
When you have a file called HEAD in your work tree, many commands that
our scripts feed "HEAD" to would complain about the rev vs path
ambiguity.  A solution is to form command line more carefully by
appending -- to them, which makes it clear that we mean HEAD rev not
HEAD file.

This patch would apply to maint.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 16:41:18 -08:00
Johannes Schindelin
b3a4f8586b bash completion: add diff options
I use "git diff" (the porcelain) really often, and am almost as often
annoyed that the completions do not know how to complete something simple
as --cached.  Now they do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 16:20:31 -08:00
Johannes Schindelin
c67bbc55f0 git checkout's reflog: even when detaching the HEAD, say from where
When checking out another ref, the reflogs already record from which
branch you switched.  Do that also when switching to a detached HEAD.

While at it, record also when coming _from_ a detached HEAD.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 16:20:13 -08:00
Steffen Prohaska
9e42d6a1c5 sha1_file.c: Fix size_t related printf format warnings
The old way of fixing warnings did not succeed on MinGW.  MinGW
does not support C99 printf format strings for size_t [1].  But
gcc on MinGW issues warnings if C99 printf format is not used.
Hence, the old stragegy to avoid warnings fails.

[1] http://www.mingw.org/MinGWiki/index.php/C99

This commits passes arguments of type size_t through a tiny
helper functions that casts to the type expected by the format
string.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 16:03:38 -08:00
Jeff King
0673c96db9 Revert "t5516: test update of local refs on push"
This reverts commit 09fba7a59d.

These tests are superseded by the ones in t5404 (added in
6fa92bf3 and 8736a848), which are more extensive and better
organized.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 15:52:23 -08:00
Jan Hudec
1e72a40de9 Improve description of git-branch -d and -D in man page.
Some users expect that deleting a remote-tracking branch would prevent
fetch from creating it again, so be explcit about that it's not the case.
Also be a little more explicit about what fully merged means.

Signed-off-by: Jan Hudec <bulb@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 15:50:59 -08:00
Ralf Wildenhues
280e50c7e5 Document all help keys in "git add -i" patch mode.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 15:46:46 -08:00
Johannes Schindelin
16ed34ad35 filter-branch: fix dirty way to provide the helpers to commit filters
The helper functions 'map' and 'skip_commit' were provided to commit
filters by sourcing filter-branch itself.  This was done with a certain
environment variable set to indicate that only the functions should be
defined, and the script should return then.

This was really hacky, and it did not work all that well, since the
full path to git-filter-branch was not known at all times.

Avoid that by putting the functions into a variable, and eval'ing
that variable.  The commit filter gets these functions by prepending
the variable to the specified commands.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 15:19:35 -08:00
Jeff King
0750d75115 cvsimport: miscellaneous packed-ref fixes
These were found with a grep for '$git_dir'; they all
replace a direct access of "$git_dir/refs/..." with a call
to git-rev-parse or git-update-ref.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 14:38:35 -08:00
Jeff King
9da0dabcd9 cvsimport: use rev-parse to support packed refs
Previously, if refs were packed, git-cvsimport would assume
that particular refs did not exist. This could lead to, for
example, overwriting previous 'origin' commits that were
packed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 14:38:06 -08:00
Jeff King
795c7c0b08 Add basic cvsimport tests
We weren't even testing basic things before, so let's at
least try importing and updating a trivial repository, which
will catch total breakage.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 14:14:21 -08:00
Alex Riesen
7168624c35 Do not generate full commit log message if it is not going to be used
Like when it is already specified through -C, -F or -m to git-commit.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-28 14:03:59 -08:00
Pascal Obry
aa4f31d5a3 git-stash: do not get fooled with "color.diff = true"
When colors are set to "true" on the repository, the git log output
will contain control characters to set/reset the colors, even when
the output is to a pipe. This makes list_stash() fail as the
downstream sed does not see what it is expecting.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-27 20:42:21 -08:00
Shawn O. Pearce
e475fe16a9 Remove git-status from list of scripts as it is builtin
Now that git-status is builtin on Cygwin this compiles as
git-status.exe.  We cannot continue to include git-status
as a Makefile target as it will never be built.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-27 20:22:33 -08:00
Christian Stimming
6f4ec3aa29 Update German translation. 100% completed.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-11-26 21:09:52 -05:00
Christian Stimming
aa7db34778 Update git-gui.pot with latest (few) string additions and changes.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-11-26 21:09:47 -05:00
Steffen Prohaska
ecf4831d89 Use is_absolute_path() in diff-lib.c, lockfile.c, setup.c, trace.c
Using the helper function to test for absolute paths makes porting easier.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-26 12:32:05 -08:00
Wincent Colaiuta
e0fda6abd1 Fix typo in draft 1.5.4 release notes
Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-26 12:32:04 -08:00
Kristian Høgsberg
a98b819183 Fix off-by-one error when truncating the diff out of the commit message.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-26 09:14:49 -08:00
Pierre Habouzit
8babab95af builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well.
The editor program to let the user edit the log message used to
get GIT_INDEX_FILE environment variable pointing at the right
file, but this was lost when git-commit was rewritten in C.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Acked-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-26 09:13:17 -08:00
Jeff King
10507857fe git-tag: test that -s implies an annotated tag
This detects a regression introduced while moving git-tag to a C
builtin.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 21:23:28 -08:00
Junio C Hamano
1ab58e8d6f Merge branch 'maint'
* maint:
  user-manual: recovering from corruption
  user-manual: clarify language about "modifying" old commits
  user-manual: failed push to public repository
  user-manual: define "branch" and "working tree" at start
  git-checkout: describe detached head correctly
2007-11-25 19:10:01 -08:00
Junio C Hamano
dc3e3ea3c8 Merge branch 'maint' of git://linux-nfs.org/~bfields/git into maint
* 'maint' of git://linux-nfs.org/~bfields/git:
  user-manual: recovering from corruption
  user-manual: clarify language about "modifying" old commits
  user-manual: failed push to public repository
  user-manual: define "branch" and "working tree" at start
2007-11-25 19:04:27 -08:00
J. Bruce Fields
1cdade2c4c user-manual: recovering from corruption
Some instructions on dealing with corruption of the object database.

Most of this text is from an example by Linus, identified by Nicolas
Pitre <nico@cam.org> with a little further editing by me.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
2007-11-25 21:13:10 -05:00
André Goddard Rosa
84ef033832 Print the real filename that we failed to open.
When we fail to open a temporary file to be renamed to something else,
we reported the final filename, not the temporary file we failed to
open.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 16:53:32 -08:00
J. Bruce Fields
7cb192eab0 user-manual: clarify language about "modifying" old commits
It's important to remember that git doesn't really allowing "editing" or
"modifying" commits, only replacing them by new commits.  Redo some of
the language to make this clearer.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-11-25 19:01:57 -05:00
Junio C Hamano
757f58ed38 revert/cherry-pick: do not mention the original ref
When you cherry-pick or revert a commit, naming it with an annotated
tag, we added a comment, attempting to repeat what we got from the end
user, to the message.

But this was inconsistent.  When we got "cherry-pick branch", we
recorded the object name (40-letter SHA-1) without saying anything like
"original was 'branch'".  There was no need to.  Also recent rewrite to
use parse-options made it impossible to parrot the original command line
without "unparsing".

This removes the code that implements the misguided "we dereferenced the
tag so record that in the commit message" behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 15:56:55 -08:00
Junio C Hamano
c1a41b9d04 "git-tag -s" should create a signed annotated tag
The earlier patch 3968658599 (Make
builtin-tag.c use parse_options.) broke "git-tag -s".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 15:47:29 -08:00
J. Bruce Fields
81eb417ad4 user-manual: failed push to public repository
More details on the case of a failed push to a public (non-shared)
repository.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-11-25 18:14:28 -05:00
Wincent Colaiuta
b63e995001 Add "--patch" option to git-add--interactive
When the "--patch" option is supplied, the patch_update_cmd() function is
called bypassing the main_loop() and exits.

Seeing as builtin-add is the only caller of git-add--interactive we can
impose a strict requirement on the format of the arguments to avoid
possible ambiguity: an "--" argument must be used whenever any pathspecs
are passed, both with the "--patch" option and without it.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
2007-11-25 11:37:55 -08:00
J. Bruce Fields
0c4a33b54f user-manual: define "branch" and "working tree" at start
Some explanation here might help.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2007-11-25 14:06:12 -05:00
Junio C Hamano
f0c4881fac git-checkout: describe detached head correctly
When you have a file called HEAD in the work tree, the code to report
where the HEAD is at when "git checkout $commit^0" is done triggered
unnecessary ambiguity checking.

Explicitly mark the command line with "--" and make it clear that we are
talking about a revision.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 10:38:22 -08:00
Junio C Hamano
3f061887c5 add -i: Fix running from a subdirectory
This fixes the pathspec interactive_add() passes to the underlying
git-add--interactive helper.  When the command was run from a
subdirectory, cmd_add() already has gone up to the toplevel of the work
tree, and the helper will be spawned from there.  The pathspec given on
the command line from the user needs to be adjusted for this.

This adds "validate_pathspec()" function in the callchain, but it does
not validate yet.  The function can be changed to barf if there are
unmatching pathspec given by the user, but that is not strictly
necessary.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 10:23:13 -08:00
Junio C Hamano
324ccbd6a0 builtin-add: fix command line building to call interactive
The earlier 7c0ab44589 (Teach builtin-add
to pass multiple paths to git-add--interactive) did not allocate enough,
and had unneeded (void*) pointer arithmetic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-25 10:23:10 -08:00
Junio C Hamano
f64fe7b481 Merge branch 'kh/commit' into wc/add-i
This is to use a few functions refactored to use in the built-in
commit series.

* kh/commit: (28 commits)
  Add a few more tests for git-commit
  builtin-commit: Include the diff in the commit message when verbose.
  builtin-commit: fix partial-commit support
  Fix add_files_to_cache() to take pathspec, not user specified list of files
  Export three helper functions from ls-files
  builtin-commit: run commit-msg hook with correct message file
  builtin-commit: do not color status output shown in the message template
  file_exists(): dangling symlinks do exist
  Replace "runstatus" with "status" in the tests
  t7501-commit: Add test for git commit <file> with dirty index.
  builtin-commit: Clean up an unused variable and a debug fprintf().
  Call refresh_cache() when updating the user index for --only commits.
  builtin-commit: Add newline when showing which commit was created
  builtin-commit: resurrect behavior for multiple -m options
  builtin-commit --s: add a newline if the last line was not a S-o-b
  builtin-commit: fix --signoff
  git status: show relative paths when run in a subdirectory
  builtin-commit: Refresh cache after adding files.
  builtin-commit: fix reflog message generation
  launch_editor(): read the file, even when EDITOR=:
  ...
2007-11-25 08:46:29 -08:00