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

100 commits

Author SHA1 Message Date
Brian Hetro
09b0d9dde0 When nothing to git-commit, honor the git-status color setting.
Instead of disabling color all of the time during a git-commit, allow
the user's config preference in the situation where there is nothing
to commit.  In this situation, the status is printed to the terminal
and not sent to COMMIT_EDITMSG, so honoring the status color setting
is expected.

Signed-off-by: Brian Hetro <whee@smaertness.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-26 14:01:47 -07:00
Junio C Hamano
6d4bbebd35 git-commit.sh: Permit the --amend message to be given with -m/-c/-C/-F.
[jc: adjusted t/t7501 as this makes -F and --amend compatible]

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-01 18:15:43 -07:00
Steven Grimm
d1cc130a5e Teach git-commit about commit message templates.
These are useful in organizations that enforce particular formats
for commit messages, e.g., to specify bug IDs or test plans.
Use of the template is not enforced; it is simply used as the
initial content when the editor is invoked.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-24 20:46:54 -07:00
Adam Roben
ef0c2abf3e Add GIT_EDITOR environment and core.editor configuration variables
These variables let you specify an editor that will be launched in
preference to the EDITOR and VISUAL environment variables. The order
of preference is GIT_EDITOR, core.editor, EDITOR, VISUAL.

[jc: added a test and config variable documentation]

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-20 00:46:34 -07:00
Josh Triplett
9d6f220cc8 Remove useless uses of cat, and replace with filename arguments
Replace uses of cat that do nothing but writing the contents of
a single file to another command via pipe.

[jc: Original patch from Josh was somewhat buggy and rewrote
"cat $file | wc -l" to "wc -l $file", but this one should be Ok.]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14 01:07:44 -07:00
Gerrit Pape
a7342913e2 git-commit: don't add multiple Signed-off-by: from the same identity
If requested to signoff a commit, don't add another Signed-off-by: line
to the commit message if the exact same line is already there.

This was noticed and requested by Josh Triplett through
 http://bugs.debian.org/430851

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-08 18:24:19 -07:00
Johannes Schindelin
b4372ef136 Enable "git rerere" by the config variable rerere.enabled
Earlier, "git rerere" was enabled by creating the directory
.git/rr-cache.  That is definitely not in line with most other
features, which are enabled by a config variable.

So, check the config variable "rerere.enabled". If it is set
to "false" explicitely, do not activate rerere, even if
.git/rr-cache exists. This should help when you want to disable
rerere temporarily.

If "rerere.enabled" is not set at all, fall back to detection
of the directory .git/rr-cache.

[jc: with minimum tweaks]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06 22:39:15 -07:00
Junio C Hamano
5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Johannes Schindelin
0cae23467a Move the pick_author code to git-sh-setup
At the moment, only git-commit uses that code, to pick the author name,
email and date from a given commit.

This code will be reused in git rebase --interactive.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-24 17:45:01 -07:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Junio C Hamano
d1c7c27ea3 Merge branch 'maint-1.5.1' into maint
* maint-1.5.1:
  Fix git-svn to handle svn not reporting the md5sum of a file, and test.
  More echo "$user_message" fixes.
  Add tests for the last two fixes.
  git-commit: use printf '%s\n' instead of echo on user-supplied strings
  git-am: use printf instead of echo on user-supplied strings
  Documentation: Add definition of "evil merge" to GIT Glossary
  Replace the last 'dircache's by 'index'
  Documentation: Clean up links in GIT Glossary
2007-05-26 01:30:40 -07:00
Junio C Hamano
293623edbc git-commit: use printf '%s\n' instead of echo on user-supplied strings
This fixes the same issue git-am had, which was fixed by Jeff
King in the previous commit.  Cleverly enough, this commit's log
message is a good test case at the same time.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-26 00:23:23 -07:00
Michael S. Tsirkin
c7263d4d3d Display the subject of the commit just made.
Useful e.g. to figure out what I did from screen history,
or to make sure subject line is short enough and makes sense
on its own.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 01:06:00 -07:00
Junio C Hamano
5e7f56ac33 git-read-tree --index-output=<file>
This corrects the interface mistake of the previous one, and
gives a command line parameter to the only plumbing command that
currently needs it: "git-read-tree".

We can add the calls to set_alternate_index_output() to other
plumbing commands that update the index if/when needed.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 23:44:32 -07:00
Junio C Hamano
30ca07a249 _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative index file.
When defined, this allows plumbing commands that update the
index (add, apply, checkout-index, merge-recursive, mv,
read-tree, rm, update-index, and write-tree) to write their
resulting index to an alternative index file while holding a
lock to the original index file.  With this, git-commit that
jumps the index does not have to make an extra copy of the index
file, and more importantly, it can do the update while holding
the lock on the index.

However, I think the interface to let an environment variable
specify the output is a mistake, as shown in the documentation.
If a curious user has the environment variable set to something
other than the file GIT_INDEX_FILE points at, almost everything
will break.  This should instead be a command line parameter to
tell these plumbing commands to write the result in the named
file, to prevent stupid mistakes.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-03 23:44:32 -07:00
Junio C Hamano
0a98f9d138 Merge branch 'maint' to synchronize with 1.5.0.6 2007-03-28 15:39:57 -07:00
Junio C Hamano
d3e41ebff4 git-commit: "read-tree -m HEAD" is not the right way to read-tree quickly
It still looks at the working tree and checks for locally
modified paths.  When are preparing a temporary index from HEAD,
we do not want any of that.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-28 03:34:55 -07:00
Paolo Bonzini
6cbf07efc5 git-commit: add a --interactive option
The --interactive option behaves like "git commit", except that
"git add --interactive" is executed before committing.  It is
incompatible with -a and -i.

Signed-off-by: Paolo Bonzini  <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-09 00:05:23 -08:00
Junio C Hamano
31930b5bee Merge branch 'maint'
* maint:
  git-commit: cd to top before showing the final stat
2007-03-05 23:11:54 -08:00
Junio C Hamano
c93d88a574 git-commit: cd to top before showing the final stat
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-05 23:11:19 -08:00
Junio C Hamano
048f48a2fd Merge branch 'master' into js/diff-ni
* master: (201 commits)
  Documentation: link in 1.5.0.2 material to the top documentation page.
  Documentation: document remote.<name>.tagopt
  GIT 1.5.0.2
  git-remote: support remotes with a dot in the name
  Documentation: describe "-f/-t/-m" options to "git-remote add"
  diff --cc: fix display of symlink conflicts during a merge.
  merge-recursive: fix longstanding bug in merging symlinks
  merge-index: fix longstanding bug in merging symlinks
  diff --cached: give more sensible error message when HEAD is yet to be created.
  Update tests to use test-chmtime
  Add test-chmtime: a utility to change mtime on files
  Add Release Notes to prepare for 1.5.0.2
  Allow arbitrary number of arguments to git-pack-objects
  rerere: do not deal with symlinks.
  rerere: do not skip two conflicted paths next to each other.
  Don't modify CREDITS-FILE if it hasn't changed.
  diff-patch: Avoid emitting double-slashes in textual patch.
  Reword git-am 3-way fallback failure message.
  Limit filename for format-patch
  core.legacyheaders: Use the description used in RelNotes-1.5.0
  ...
2007-02-26 01:20:42 -08:00
Fredrik Kuivinen
755b99d815 Fix 'git commit -a' in a newly initialized repository
With current git:

$ git init
$ git commit -a
cp: cannot stat `.git/index': No such file or directory

Output a nice error message instead.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-22 21:02:39 -08:00
Junio C Hamano
2b5f9a8c0c git-status: do not be totally useless in a read-only repository.
This makes git-status work semi-decently in a read-only
repository.  Earlier, the command simply died with "cannot lock
the index file" before giving any useful information to the
user.

Because index won't be updated in a read-only repository,
stat-dirty paths appear in the "Changed but not updated" list.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-22 00:31:51 -08:00
Junio C Hamano
23913dc713 honor GIT_REFLOG_ACTION in git-commit
This allows git-cherry-pick and git-revert to properly identify
themselves in the resulting reflog entries.  Earlier they were
recorded as what git-commit has done.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 15:17:49 -08:00
Junio C Hamano
dbaa06a2b0 git-commit -s: no extra space when sign-offs appear at the end already.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-29 01:06:27 -08:00
Tom Prince
e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Peter Eriksen
497171e765 Documentation: --amend cannot be combined with -c/-C/-F.
We used to get the following confusing error message:

    $ git commit --amend -a -m foo
    Option -m cannot be combined with -c/-C/-F

This is because --amend cannot be combined with -c/-C/-F, which makes
sense, because they try to handle the same log message in different ways.
So update the documentation to reflect this.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24 15:32:52 -08:00
Junio C Hamano
83e24dce14 [PATCH] honor --author even with --amend, -C, and -c.
Earlier code discarded GIT_AUTHOR_DATE taken from the base
commit when --author was specified.  This was often wrong as
that use is likely to fix the spelling of author's name.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 19:40:57 -08:00
Junio C Hamano
f4b6c6b90f Merge branch 'jc/int'
* jc/int:
  More tests in t3901.
  Consistent message encoding while reusing log from an existing commit.
  t3901: test "format-patch | am" pipe with i18n
  Use log output encoding in --pretty=email headers.
2007-01-14 12:04:25 -08:00
Junio C Hamano
5ac2715f2e Consistent message encoding while reusing log from an existing commit.
The following commands can reuse log message from an existing
commit while creating a new commit:

	git-cherry-pick
	git-rebase (both with and without --merge)
	git-commit (-c and -C)

When the original commit was made in a different encoding from
the current i18n.commitencoding, "cat-file commit" would give a
string that is inconsistent with what the resulting commit will
claim to be in.  Replace them with "git show -s --encoding".

"git-rebase" without --merge is "git format-patch" piped to "git
am" in essence, and has been taken care of before this commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-13 13:33:07 -08:00
Junio C Hamano
514c09fdcf Use cd_to_toplevel in scripts that implement it by hand.
This converts scripts that do "cd $(rev-parse --show-cdup)" by
hand to use cd_to_toplevel.

I think git-fetch does not have to go to the toplevel, but that
should be dealt with in a separate patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12 16:54:38 -08:00
Junio C Hamano
e861ce1692 Merge branch 'jc/bare'
* jc/bare:
  Disallow working directory commands in a bare repository.
  git-fetch: allow updating the current branch in a bare repository.
  Introduce is_bare_repository() and core.bare configuration variable
  Move initialization of log_all_ref_updates
2007-01-11 16:50:36 -08:00
Shawn O. Pearce
7eff28a9b4 Disallow working directory commands in a bare repository.
If the user tries to run a porcelainish command which requires
a working directory in a bare repository they may get unexpected
results which are difficult to predict and may differ from command
to command.

Instead we should detect that the current repository is a bare
repository and refuse to run the command there, as there is no
working directory associated with it.

[jc: updated Shawn's original somewhat -- bugs are mine.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 15:03:09 -08:00
Michael Loeffler
521f9c4def git-commit: do not fail to print the diffstat even if there is a file named HEAD
Signed-off-by: Michael Loeffler <zvpunry@zvpunry.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 14:45:59 -08:00
Junio C Hamano
96a738c0dd Remove unused variable (git-commit.sh)
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-01 23:42:53 -08:00
Shawn O. Pearce
aeb80c70ec Suggest use of "git add file1 file2" when there is nothing to commit.
If a user modifies files and runs 'git commit' (without the very
useful -a option) and they have not yet updated the index they
are probably coming from another SCM-like tool which would perform
the same as 'git commit -a' in this case.  Showing the user their
current status and a final line of "nothing to commit" is not very
reassuring, as the user might believe that Git did not recognize
their files were modified.

Instead we can suggest as part of the 'nothing to commit' message
that the user invoke 'git add' to add files to their next commit.

Suggested by Andy Parkins' Git 'niggles' list
(<200612132237.10051.andyparkins@gmail.com>).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:31:01 -08:00
Nicolas Pitre
ebd124c678 make commit message a little more consistent and conforting
It is nicer to let the user know when a commit succeeded all the time,
not only the first time.  Also the commit sha1 is much more useful than
the tree sha1 in this case.

This patch also introduces a -q switch to supress this message as well
as the summary of created/deleted files.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-15 22:29:54 -08:00
Junio C Hamano
78ba00407c Merge branch 'np/addcommit'
* np/addcommit:
  git-commit: allow --only to lose what was staged earlier.
  Documentation/git-commit: rewrite to make it more end-user friendly.
  make 'git add' a first class user friendly interface to the index
2006-12-13 11:08:20 -08:00
Junio C Hamano
158d057789 git-commit: allow --only to lose what was staged earlier.
The command used to have a safety valve to prevent this sequence:

	edit foo
	git update-index foo
	edit foo
	git diff foo
	git commit --only foo

The reason for this was because an inexperienced user might
mistakenly think what is shown with the last-minute diff
contains all the change that is being committed (instead, what
the user asked to check was an incremental diff since what has
been staged so far).  However, this turns out to only annoy
people who know what they are doing.  Inexperienced people
would not be using the first "update-index" anyway, in which
case they would see the full changes in the "git diff".

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-10 14:50:40 -08:00
Junio C Hamano
61f5cb7f0d git-commit: show --summary after successful commit.
Sometimes people accidentally commit files in wrong mode bits.
Show --summary output for the HEAD commit after successful commit
as a final sanity check.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 00:20:01 -08:00
Junio C Hamano
58a1e0e83b Merge branch 'lj/refs'
* lj/refs: (63 commits)
  Fix show-ref usagestring
  t3200: git-branch testsuite update
  sha1_name.c: avoid compilation warnings.
  Make git-branch a builtin
  ref-log: fix D/F conflict coming from deleted refs.
  git-revert with conflicts to behave as git-merge with conflicts
  core.logallrefupdates thinko-fix
  git-pack-refs --all
  core.logallrefupdates create new log file only for branch heads.
  Remove bashism from t3210-pack-refs.sh
  ref-log: allow ref@{count} syntax.
  pack-refs: call fflush before fsync.
  pack-refs: use lockfile as everybody else does.
  git-fetch: do not look into $GIT_DIR/refs to see if a tag exists.
  lock_ref_sha1_basic does not remove empty directories on BSD
  Do not create tag leading directories since git update-ref does it.
  Check that a tag exists using show-ref instead of looking for the ref file.
  Use git-update-ref to delete a tag instead of rm()ing the ref file.
  Fix refs.c;:repack_without_ref() clean-up path
  Clean up "git-branch.sh" and add remove recursive dir test cases.
  ...
2006-11-01 08:48:50 -08:00
Luben Tuikov
a9cb3c6ecb git-revert with conflicts to behave as git-merge with conflicts
In a busy project, reverting a commit almost always results
in a conflict between one or more files (depending on the
commit being reverted).  It is useful to record this
conflict in the commit-to-be message of the resulting commit
(after the resolve).  The process now becomes:

git-revert <SHA-1>
<git complains and prints failed automatic>
<user manually resolves>
git-update-index <resolved files>
git-commit -s

And the commit message is now a merge of the revert commit
message and the conflict commit message, giving the user a
chance to edit it or add more information:

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-15 23:06:31 -07:00
Martin Waitz
3de63c3f9f git-commit: fix coding style.
git-commit.sh was using a mixture of spaces and tabs for indentation.
This is changed to one tab per indentation level.
No code changes.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-07 21:28:17 -07:00
Martin Waitz
c065b6e429 git-commit: cleanup unused function.
The report() function is not used anymore. Kill it.

Signed-off-by: Martin Waitz <tali@admingilde.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 23:58:38 -07:00
Junio C Hamano
cede752653 update a few Porcelain-ish for ref lock safety.
This updates the use of git-update-ref in git-branch, git-tag
and git-commit to make them safer in a few corner cases as
demonstration.

 - git-tag makes sure that the named tag does not exist, allows
   you to edit tag message and then creates the tag.  If a tag
   with the same name was created by somebody else in the
   meantime, it used to happily overwrote it.  Now it notices
   the situation.

 - git-branch -d and git-commit (for the initial commit) had the
   same issue but with smaller race window, which is plugged
   with this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-27 02:06:31 -07:00
Johannes Schindelin
2074cb0af3 Teach runstatus about --untracked
Actually, teach runstatus what to do if it is not passed; it should not list
the contents of completely untracked directories, but only the name of that
directory (plus a trailing '/').

[jc: with comments by Jeff King to match hide-empty-directories
 behaviour of the original.]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-12 23:20:17 -07:00
Jeff King
c91f0d92ef git-commit.sh: convert run_status to a C builtin
This creates a new git-runstatus which should do roughly the same thing
as the run_status function from git-commit.sh. Except for color support,
the main focus has been to keep the output identical, so that it can be
verified as correct and then used as a C platform for other improvements to
the status printing code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-08 16:46:35 -07:00
Alex Riesen
3dffd2c828 Do not use perl in git-commit.sh
git-commit.sh has the only one place where perl is used
and there it can quite trivially be done in sh.

git-ls-files without "-z" produces quoted output, even if
is different from that produced by perl code it is good
enough.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-13 22:00:16 -07:00
Shawn Pearce
a3a733e63b Record the type of commit operation in the reflog.
If committing a merge (.git/MERGE_HEAD exists), an initial tree
(no HEAD) or using --amend to amend the prior commit then denote
the subtype of commit in the reflog.  This helps to distinguish
amended or merge commits from normal commits.

In the case of --amend the prior sha1 is probably the commit which
is being thrown away in favor of the new commit.  Since it is likely
that the old commit doesn't have any ref pointing to it anymore
it can be interesting to know why that the commit was replaced
and orphaned.

In the case of a merge the prior sha1 is probably the first parent
of the new merge commit.  Consequently having its prior sha1 in the
reflog is slightly less interesting but its still informative to
know the commit was the result of a merge which had to be completed
by hand.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 21:21:16 -07:00
Pavel Roskin
82e5a82fd7 Fix more typos, primarily in the code
The only visible change is that git-blame doesn't understand
"--compability" anymore, but it does accept "--compatibility" instead,
which is already documented.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 00:36:44 -07:00