aboutsummaryrefslogtreecommitdiff
path: root/git-commit.sh
Commit message (Collapse)AuthorAge
* Do not use perl in git-commit.shAlex Riesen2006-07-13
| | | | | | | | | | | | 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>
* Record the type of commit operation in the reflog.Shawn Pearce2006-07-10
| | | | | | | | | | | | | | | | | | | | | | 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>
* Fix more typos, primarily in the codePavel Roskin2006-07-10
| | | | | | | | | 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>
* Using 'perl' in *.shMichal Rokos2006-07-08
| | | | | | | | Some GIT's shell script are using bare 'perl' for perl invocation. Use @@PERL@@ symbol and replace it with PERL_PATH_SQ everywhere. Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Racy GIT (part #3)Junio C Hamano2006-06-29
| | | | | | | | | Commit 29e4d3635709778bcc808dbad0477efad82f8d7e fixed the underlying update-index races but git-commit was not careful enough to preserve the index file timestamp when copying the index file. This caused t3402 test to occasionally fail. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix expr usage for FreeBSDDennis Stosberg2006-06-27
| | | | | | | | Some implementations of "expr" (e.g. FreeBSD's) fail, if an argument starts with a dash. Signed-off-by: Dennis Stosberg <dennis@stosberg.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/squash'Junio C Hamano2006-06-26
|\ | | | | | | | | * jc/squash: git-merge --squash
| * git-merge --squashJunio C Hamano2006-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some people tend to do many little commits on a topic branch, recording all the trials and errors, and when the topic is reasonably cooked well, would want to record the net effect of the series as one commit on top of the mainline, removing the cruft from the history. The topic is then abandoned or forked off again from that point at the mainline. The barebone porcelainish that comes with core git tools does not officially support such operation, but you can fake it by using "git pull --no-merge" when such a topic branch is not a strict superset of the mainline, like this: git checkout mainline git pull --no-commit . that-topic-branch : fix conflicts if any rm -f .git/MERGE_HEAD git commit -a -m 'consolidated commit log message' git branch -f that-topic-branch ;# now fully merged This however does not work when the topic branch is a fast forward of the mainline, because normal "git pull" will never create a merge commit in such a case, and there is nothing special --no-commit could do to begin with. This patch introduces a new option, --squash, to support such a workflow officially in both fast-forward case and true merge case. The user-level operation would be the same in both cases: git checkout mainline git pull --squash . that-topic-branch : fix conflicts if any -- naturally, there would be : no conflict if fast forward. git commit -a -m 'consolidated commit log message' git branch -f that-topic-branch ;# now fully merged When the current branch is already up-to-date with respect to the other branch, there truly is nothing to do, so the new option does not have any effect. This was brought up in #git IRC channel recently. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-commit: filter out log message lines only when editor was run.Yann Dirson2006-06-25
|/ | | | | | | | | | | | | | | | The current behaviour strips out lines starting with a # even when fed through stdin or -m. This is particularly bad when importing history from another SCM (tailor 0.9.23 uses git-commit). In the best cases all lines are stripped and the commit fails with a confusing "empty log message" error, but in many cases the commit is done, with loss of information. Note that it is quite peculiar to just have "#" handled as a leading comment char here. One commonly meet CVS: or CG: or STG: as prefixes, and using GIT: would be more robust as well as consistent with other commit tools. However, that would break any tool relying on the # (if any). Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: allow -e option anywhere on command lineJeff King2006-06-23
| | | | | | | | | | Previously, the command 'git-commit -e -m foo' would ignore the '-e' option because the '-m' option overwrites the no_edit flag during sequential option parsing. Now we cause -e to reset the no_edit flag after all options are parsed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'master' into nextJunio C Hamano2006-05-31
|\ | | | | | | | | | | * master: send-email: only 'require' instead of 'use' Net::SMTP Allow multiple -m options to git-commit.
| * Allow multiple -m options to git-commit.Shawn Pearce2006-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I find it very convenient to be able to supply multiple paragraphs of text on the command line with a single git-commit call. This change permits multiple -m/--message type options to be supplied to git-commit with each message being added as its own paragraph of text in the commit message. The -m option is still not permitted with -c/-C/-F nor are multiple occurrences of these options permitted. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge branch 'master' into nextJunio C Hamano2006-05-26
|\ \ | |/ | | | | | | | | | | * master: Call builtin ls-tree in git-cat-file -p built-in format-patch: various fixups. Add instructions to commit template.
| * Add instructions to commit template.Martin Waitz2006-05-26
| | | | | | | | | | | | | | | | New users can be irritated by the git status text in their editor. Let's give them a short help. Signed-off-by: Martin Waitz <tali@admingilde.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge branch 'sp/reflog' into nextJunio C Hamano2006-05-23
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sp/reflog: Enable ref log creation in git checkout -b. Create/delete branch ref logs. Include ref log detail in commit, reset, etc. Change order of -m option to update-ref. Correct force_write bug in refs.c Change 'master@noon' syntax to 'master@{noon}'. Log ref updates made by fetch. Force writing ref if it doesn't exist. Added logs/ directory to repository layout. General ref log reading improvements. Fix ref log parsing so it works properly. Support 'master@2 hours ago' syntax Log ref updates to logs/refs/<ref> Convert update-ref to use ref_lock API. Improve abstraction of ref lock/write.
| * Include ref log detail in commit, reset, etc.Shawn Pearce2006-05-19
| | | | | | | | | | | | | | | | When updating a ref at the direction of the user include a reason why head was changed as part of the ref log (assuming it was enabled). Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git status: skip empty directories, and add -u to show all untracked filesMatthias Lederhofer2006-05-23
|/ | | | | | | | | | | | By default, we use --others --directory to show uninteresting directories (to get user's attention) without their contents (to unclutter output). Showing empty directories do not make sense, so pass --no-empty-directory when we do so. Giving -u (or --untracked) disables this uncluttering to let the user get all untracked files. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Ensure author & committer before asking for commit message.Sean2006-05-14
| | | | | | | | It's better to find out you need to fix your author and committer information before you enter a long commit message. Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit --amend: two fixes.Junio C Hamano2006-04-20
| | | | | | | | | | | | | | | | When running "git commit --amend" only to fix the commit log message without any content change, we mistakenly showed the git-status output that says "nothing to commit" without commenting it out. If you have already run update-index but you want to amend the top commit, "git commit --amend --only" without any paths should have worked, because --only means "starting from the base commit, update-index these paths only to prepare the index to commit, and perform the commit". However, we refused -o without paths. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Shell utilities: Guard against expr' magic tokens.Mark Wooding2006-04-13
| | | | | | | | | Some words, e.g., `match', are special to expr(1), and cause strange parsing effects. Track down all uses of expr and mangle the arguments so that this isn't a problem. Signed-off-by: Mark Wooding <mdw@distorted.org.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: do not muck with commit message when no_edit is set.Junio C Hamano2006-04-12
| | | | | | | | | | | | | Spotted by Linus and Darrin Thompson. When we took a commit message from -F <file> with an incomplete line, we appended "git status" output, which ended up attaching a lone "#" at the end. We still need the "do we have anything to commit?" check by running "status" (which has to know what to do in different cases with -i/-o/-a), but there is no point appending its output to the proposed commit message given by the user. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Be verbose when !initial commitYasushi SHOJI2006-03-20
| | | | | | | | | | | | | verbose option in git-commit.sh lead us to run git-diff-index, which needs a commit-ish we are making diff against. When we are commiting the fist set, we obviously don't have any commit-ish in the repo. So we just skip the git-diff-index run. It might be possible to produce diff against empty but do we need that? Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit --amend: allow empty commit.Junio C Hamano2006-03-05
| | | | | | | | When amending a commit only to update the commit log message, git-status would rightly say "Nothing to commit." Do not let this prevent commit to be made. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: make sure we protect against races.Junio C Hamano2006-03-02
| | | | | | | | | | An earlier commit 8098a178b26dc7a158d129a092a5b78da6d12b72 accidentally lost race protection from git-commit command. This commit reinstates it. When something else updates HEAD pointer while you were editing your commit message, the command would notice and abort the commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit --amendJunio C Hamano2006-03-02
| | | | | | | | | | | | | | | | | | | | The new flag is used to amend the tip of the current branch. Prepare the tree object you would want to replace the latest commit as usual (this includes the usual -i/-o and explicit paths), and the commit log editor is seeded with the commit message from the tip of the current branch. The commit you create replaces the current tip -- if it was a merge, it will have the parents of the current tip as parents -- so the current top commit is discarded. It is a rough equivalent for: $ git reset --soft HEAD^ $ ... do something else to come up with the right tree ... $ git commit -c ORIG_HEAD but can be used to amend a merge commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/commit'Junio C Hamano2006-02-14
|\ | | | | | | | | | | | | * jc/commit: commit: detect misspelled pathspec while making a partial commit. combine-diff: diff-files fix (#2) combine-diff: diff-files fix.
| * commit: detect misspelled pathspec while making a partial commit.Junio C Hamano2006-02-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you say "git commit Documentaiton" to make partial commit for the files only in that directory, we did not detect that as a misspelled pathname and attempted to commit index without change. If nothing matched, there is no harm done, but if the index gets modified otherwise by having another valid pathspec or after an explicit update-index, a user will not notice without paying attention to the "git status" preview. This introduces --error-unmatch option to ls-files, and uses it to detect this common user error. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-commit: Now --only semantics is the default.Junio C Hamano2006-02-12
|/ | | | | | | | This changes the "git commit paths..." to default to --only semantics from traditional --include semantics, as agreed on the list. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Only call git-rerere if $GIT_DIR/rr-cache exists.Junio C Hamano2006-02-11
| | | | | | | Johannes noticed that git-rerere depends on Digest.pm, and if one does not use the command, one can live without it. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit -v: have patch at the end.Junio C Hamano2006-02-10
| | | | | | | | | | It was pointed out that otherwise more important summary information prefixed with '#' would become prone to be missed. Also instead of chopping at the first '^---$' line, stop at the first 'diff --git a/' line. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-status -vJunio C Hamano2006-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | This revamps the git-status command to take the same set of parameters as git commit. It gives a preview of what is being committed with that command. With -v flag, it shows the diff output between the HEAD commit and the index that would be committed if these flags were given to git-commit command. git-commit also acquires -v flag (it used to mean "verify" but that is the default anyway and there is --no-verify to turn it off, so not much is lost), which uses the updated git-status -v to seed the commit log buffer. This is handy for writing a log message while reviewing the changes one last time. Now, git-commit and git-status are internally share the same implementation. Unlike previous git-commit change, this uses a temporary index to prepare the index file that would become the real index file after a successful commit, and moves it to the real index file once the commit is actually made. This makes it safer than the previous scheme, which stashed away the original index file and restored it after an aborted commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: finishing touches.Junio C Hamano2006-02-06
| | | | | | | | | | | | | | | | | | | | | | Introduce --only flag to allow the new "partial commit" semantics when paths are specified. The default is still the traditional --include semantics. Once peoples' fingers and scripts that want the traditional behaviour are updated to explicitly say --include, we could change it to either default to --only, or refuse to operate without either --only/--include when paths are specified. This also fixes a couple of bugs in the previous round. Namely: - forgot to save/restore index in some cases. - forgot to use the temporary index to show status when '--only paths...' semantics was used. - --author did not take precedence when reusing an existing commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: revamp the git-commit semantics.Junio C Hamano2006-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - "git commit" without _any_ parameter keeps the traditional behaviour. It commits the current index. We commit the whole index even when this form is run from a subdirectory. - "git commit --include paths..." (or "git commit -i paths...") is equivalent to: git update-index --remove paths... git commit - "git commit paths..." acquires a new semantics. This is an incompatible change that needs user training, which I am still a bit reluctant to swallow, but enough people seem to have complained that it is confusing to them. It 1. refuses to run if $GIT_DIR/MERGE_HEAD exists, and reminds trained git users that the traditional semantics now needs -i flag. 2. refuses to run if named paths... are different in HEAD and the index (ditto about reminding). Added paths are OK. 3. reads HEAD commit into a temporary index file. 4. updates named paths... from the working tree in this temporary index. 5. does the same updates of the paths... from the working tree to the real index. 6. makes a commit using the temporary index that has the current HEAD as the parent, and updates the HEAD with this new commit. - "git commit --all" can run from a subdirectory, but it updates the index with all the modified files and does a whole tree commit. - In all cases, when the command decides not to create a new commit, the index is left as it was before the command is run. This means that the two "git diff" in the following sequence: $ git diff $ git commit -a $ git diff would show the same diff if you abort the commit process by making the commit log message empty. This commit also introduces much requested --author option. $ git commit --author 'A U Thor <author@example.com>' Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-rerere: reuse recorded resolve.Junio C Hamano2006-02-06
| | | | | | | | | | | | | | | In a workflow that employs relatively long lived topic branches, the developer sometimes needs to resolve the same conflict over and over again until the topic branches are done (either merged to the "release" branch, or sent out and accepted upstream). This commit introduces a new command, "git rerere", to help this process by recording the conflicted automerge results and corresponding hand-resolve results on the initial manual merge, and later by noticing the same conflicted automerge and applying the previously recorded hand resolution using three-way merge. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Do not fall back on vi on dumb terminals.Junio C Hamano2006-02-04
| | | | | | | | | When TERM is set to 'dumb', do not start vi to edit the commit log message. Suggested by Amos Waterland. Signed-off-by: Junio C Hamano <junkio@cox.net>
* format-patch/commit: Quote single quote in the author name properly.Junio C Hamano2006-01-05
| | | | | | Noticed by Kyle McMartin. Signed-off-by: Junio C Hamano <junkio@cox.net>
* trivial: typo in git-commit.shAlex Riesen2006-01-05
| | | | | Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Trivial usage string clean-upfreku045@student.liu.se2005-12-14
| | | | | Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-sh-setup: die if outside git repository.Junio C Hamano2005-11-25
| | | | | | | | Now all the users of this script detect its exit status and die, complaining that it is outside git repository. So move the code that dies from all callers to git-sh-setup script. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Prevent "git-commit -a path1 path2..."Junio C Hamano2005-11-25
| | | | | | | When you want to create a partial commit, giving -a by mistake would ignore the given path. Prevent it. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Do not lose author name information to locale gotchas.Junio C Hamano2005-11-11
| | | | | | | | | | | | I noticed format-patch loses authorship information of Lukas' patch when I run git tools with LC_LANG set to ja_JP. It turns out that the sed script to set environment variables were not working on his name (encoded in UTF-8), which is unfortunate but technically correct. Force sed invocation under C locale because we always want literal byte semantics. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Do not put automatic merge message after signed-off-by line.Junio C Hamano2005-11-01
| | | | | | | | 'git-commit -s' after a failed automerge inserted the automerge message in a wrong place. The signed-off-by line should come last. Signed-off-by: Junio C Hamano <junkio@cox.net>
* update usage string for git-commit.shc.shoemaker@cox.net2005-10-28
| | | | | Signed-off-by: Chris Shoemaker <c.shoemaker at cox.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Teach git-add and git-commit to handle filenames starting with '-'.Junio C Hamano2005-10-18
| | | | | | | | | | Recent '--' fixes to "git diff" by Linus made it possible to specify filenames that start with '-'. But in order to do that, you need to be able to add and commit such file to begin with. Teach git-add and git-commit to honor the same '--' convention. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Write .editmsg in GIT_DIR to avoid being in git-status.Santi_Béjar2005-10-09
| | | | | | | | | | | | | | | It appears in the git-status output during a git-commit if you have something in info/exclude. Also for .cmitmsg and .cmitchk to make git-commit work in read-only working trees. [jc: while we are at it, I removed the use of .cmitchk temporary file which was not necessary, and renamed them -- they are out of way now and do not have to be dotfiles anymore.] Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* [PATCH] Quote the missing GIT_DIR.Santi_Béjar2005-10-05
| | | | | Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Leave an empty line between log and sign-off.Junio C Hamano2005-10-03
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add git-symbolic-refJunio C Hamano2005-10-01
| | | | | | | | | | | | | This adds the counterpart of git-update-ref that lets you read and create "symbolic refs". By default it uses a symbolic link to represent ".git/HEAD -> refs/heads/master", but it can be compiled to use the textfile symbolic ref. The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah .git/HEAD' have been converted to use new git-symbolic-ref command, so that they can deal with either implementation. Signed-off-by: Junio C Hamano <junio@twinsun.com>
* Use git-update-ref in scripts.Junio C Hamano2005-09-28
| | | | | | | | | This uses the git-update-ref command in scripts for safer updates. Also places where we used to read HEAD ref by using "cat" were fixed to use git-rev-parse. This will matter when we start using symbolic references. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-commit: use update-index --stdin, instead of xargs.Junio C Hamano2005-09-27
| | | | | | | Now update-index supports '-z --stdin', we do not have to rely on platform xargs to support -0 option. Signed-off-by: Junio C Hamano <junkio@cox.net>