aboutsummaryrefslogtreecommitdiff
path: root/builtin-commit.c
Commit message (Collapse)AuthorAge
* Merge branch 'mo/status-untracked'Junio C Hamano2008-06-22
|\ | | | | | | | | | | | | | | | | | | | | * mo/status-untracked: Add configuration option for default untracked files mode Add argument 'no' commit/status option -u|--untracked-files Add an optional <mode> argument to commit/status -u|--untracked-files option Conflicts: Documentation/git-commit.txt
| * Add argument 'no' commit/status option -u|--untracked-filesMarius Storm-Olsen2008-06-09
| | | | | | | | | | | | | | This new argument teaches Git to not look for any untracked files, saving cycles on slow file systems, or large repos. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
| * Add an optional <mode> argument to commit/status -u|--untracked-files optionMarius Storm-Olsen2008-06-09
| | | | | | | | | | | | | | | | | | | | | | | | This lets you specify how you want untracked files to be listed. The possible options are: normal - Show untracked files and directories all - Show all untracked files The 'all' mode is used, if the mode is not specified. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
* | Print errno upon failure to open the COMMIT_EDITMSG fileCristian Peraferrer2008-06-21
|/ | | | | | | | When the COMMIT_EDITMSG cannot be opened, give more information to the user by giving the 'errno' information. Signed-off-by: Cristian Peraferrer <corellian.c@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* commit: drop duplicated parentsJunio C Hamano2008-06-02
| | | | | | | | | | | | The scripted version of git-commit internally used git-commit-tree which omitted duplicated parents given from the command line. This prevented a nonsensical octopus merge from getting created even when you said "git merge A B" while you are already on branch A. However, when git-commit was rewritten in C, this sanity check was lost. This resurrects it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge 1.5.5.3 inJunio C Hamano2008-05-27
|\
| * commit --interactive: properly update the index before commitingGerrit Pape2008-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adding files through git commit --interactive, and 'quit' afterwards, the message in the editor of the commit message indicates that many (maybe all) files are deleted from the tree. Dismissing that and running git commit afterwards does the right thing. This commit fixes git commit --interactive to properly update the index before commiting. Reported by Jiří Paleček through http://bugs.debian.org/480429 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'js/config-cb'v1.5.6-rc0Junio C Hamano2008-05-25
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | * js/config-cb: Provide git_config with a callback-data parameter Conflicts: builtin-add.c builtin-cat-file.c
| * | Provide git_config with a callback-data parameterJohannes Schindelin2008-05-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'ar/add-unreadable'Junio C Hamano2008-05-21
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ar/add-unreadable: Add a config option to ignore errors for git-add Add a test for git-add --ignore-errors Add --ignore-errors to git-add to allow it to skip files with read errors Extend interface of add_files_to_cache to allow ignore indexing errors Make the exit code of add_file_to_index actually useful
| * | | Extend interface of add_files_to_cache to allow ignore indexing errorsAlex Riesen2008-05-12
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | Make the exit code of add_file_to_index actually usefulAlex Riesen2008-05-12
| |/ / | | | | | | | | | | | | | | | | | | Update the programs which used the function (as add_file_to_cache). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'sb/committer'Junio C Hamano2008-05-14
|\ \ \ | |/ / |/| | | | | | | | | | | | | | * sb/committer: commit: Show committer if automatic commit: Show author if different from committer Preparation to call determine_author_info from prepare_to_commit
| * | commit: Show committer if automaticSanti Béjar2008-05-06
| | | | | | | | | | | | | | | | | | | | | | | | To warn the user in case he/she might be using an unintended committer identity. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | commit: Show author if different from committerSanti Béjar2008-05-06
| | | | | | | | | | | | | | | | | | | | | That would help reassure anybody while committing other's changes. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Preparation to call determine_author_info from prepare_to_commitSanti Béjar2008-05-06
| | | | | | | | | | | | | | | | | | | | | | | | Reorder functions definitions such that determine_author_info is defined before prepare_to_commit. No code changes. Signed-off-by: Santi Béjar <sbejar@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Junio C Hamano2008-05-11
|\ \ \ | | |/ | |/| | | | | | | | | | | | | * maint: wt-status.h: declare global variables as extern builtin-commit.c: add -u as short name for --untracked-files git-repack: re-enable parsing of -n command line option
| * | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-05-11
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | * maint-1.5.4: wt-status.h: declare global variables as extern builtin-commit.c: add -u as short name for --untracked-files git-repack: re-enable parsing of -n command line option
| | * | builtin-commit.c: add -u as short name for --untracked-filesSitaram Chamarty2008-05-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the C code consistent with the documentation and the old shell code. Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Avoid some unnecessary lstat() callsLinus Torvalds2008-05-10
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit sequence used to do if (file_exists(p->path)) add_file_to_cache(p->path, 0); where both "file_exists()" and "add_file_to_cache()" needed to do a lstat() on the path to do their work. This cuts down 'lstat()' calls for the partial commit case by two for each path we know about (because we do this twice per path). Just move the lstat() to the caller instead (that's all that "file_exists()" really does), and pass the stat information down to the add_to_cache() function. This essentially makes 'add_to_index()' the core function that adds a path to the index, getting the index pointer, the pathname and the stat information as arguments. There are then shorthand helper functions that use this core function: - 'add_to_cache()' is just 'add_to_index()' with the default index - 'add_file_to_cache/index()' is the same, but does the lstat() call itself, so you can pass just the pathname if you don't already have the stat information available. So old users of the 'add_file_to_xyzzy()' are essentially left unchanged, and this just exposes the more generic helper function that can take existing stat information into account. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Junio C Hamano2008-04-27
|\ \ \ | |/ / | | | | | | | | | | | | * maint: clone: detect and fail on excess parameters Remove 'header' from --signoff option description
| * | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-27
| |\ \ | | |/ | | | | | | | | | * maint-1.5.4: Remove 'header' from --signoff option description
| | * Remove 'header' from --signoff option descriptionDan McGee2008-04-27
| | | | | | | | | | | | | | | Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/terminator-separator'Junio C Hamano2008-04-19
|\ \ \ | | | | | | | | | | | | | | | | * jc/terminator-separator: log: teach "terminator" vs "separator" mode to "--pretty=format"
| * | | log: teach "terminator" vs "separator" mode to "--pretty=format"Junio C Hamano2008-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge branch 'maint'Junio C Hamano2008-04-11
|\ \ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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")
| * | | Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-11
| |\ \ \ | | |/ / | |/| / | | |/ | | | | | | | | | | | | | | | * 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")
| | * Document option --only of git commitJohannes Sixt2008-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | builtin-commit.c: Remove a redundant assignment.Johannes Sixt2008-04-11
|/ / | | | | | | | | Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Make 'unpack_trees()' have a separate source and destination indexLinus Torvalds2008-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We will always unpack into our own internal index, but we will take the source from wherever specified, and we will optionally write the result to a specified index (optionally, because not everybody even _wants_ any result: the index diffing really wants to just walk the tree and index in parallel). This ends up removing a fair number more lines than it adds, for the simple reason that we can now skip all the crud that tried to be oh-so-careful about maintaining our position in the index as we were traversing and modifying it. Since we don't actually modify the source index any more, we can just update the 'o->pos' pointer without worrying about whether an index entry got removed or replaced or added to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Make 'unpack_trees()' take the index to work on as an argumentLinus Torvalds2008-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | This is just a very mechanical conversion, and makes everybody set it to '&the_index' before calling, but at least it makes it more explicit where we work with the index. The next stage would be to split that index usage up into a 'source' and a 'destination' index, so that we can unpack into a different index than we started out from. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'db/checkout'Junio C Hamano2008-02-27
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * db/checkout: (21 commits) checkout: error out when index is unmerged even with -m checkout: show progress when checkout takes long time while switching branches Add merge-subtree back checkout: updates to tracking report builtin-checkout.c: Remove unused prefix arguments in switch_branches path checkout: work from a subdirectory checkout: tone down the "forked status" diagnostic messages Clean up reporting differences on branch switch builtin-checkout.c: fix possible usage segfault checkout: notice when the switched branch is behind or forked Build in checkout Move code to clean up after a branch change to branch.c Library function to check for unmerged index entries Use diff -u instead of diff in t7201 Move create_branch into a library file Build-in merge-recursive Add "skip_unmerged" option to unpack_trees. Discard "deleted" cache entries after using them to update the working tree Send unpack-trees debugging output to stderr Add flag to make unpack_trees() not print errors. ... Conflicts: Makefile
| * | Allow callers of unpack_trees() to handle failureDaniel Barkalow2008-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Return an error from unpack_trees() instead of calling die(), and exit with an error in read-tree, builtin-commit, and diff-lib. merge-recursive already expected an error return from unpack_trees, so it doesn't need to be changed. The merge function can return negative to abort. This will be used in builtin-checkout -m. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
* | | Add color.ui variable which globally enables colorization if setMatthias Kestenholz2008-02-18
| | | | | | | | | | | | | | | Signed-off-by: Matthias Kestenholz <mk@spinlock.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'pb/prepare-commit-msg'Junio C Hamano2008-02-16
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pb/prepare-commit-msg: git-commit: add a prepare-commit-msg hook git-commit: Refactor creation of log message. git-commit: set GIT_EDITOR=: if editor will not be launched git-commit: support variable number of hook arguments
| * | | git-commit: add a prepare-commit-msg hookPaolo Bonzini2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The prepare-commit-msg hook is run whenever a "fresh" commit message is prepared, just before it is shown in the editor (if it is). Its purpose is to modify the commit message in-place. It takes one to three parameters. The first is the name of the file that the commit log message. The second is the source of the commit message, and can be: "message" (if a -m or -F option was given); "template" (if a -t option was given or the configuration option commit.template is set); "merge" (if the commit is a merge or a .git/MERGE_MSG file exists); "squash" (if a .git/SQUASH_MSG file exists); or "commit", followed by a commit SHA1 as the third parameter (if a -c, -C or --amend option was given). If its exit status is non-zero, git-commit will abort. The hook is not suppressed by the --no-verify option, so it should not be used as a replacement for the pre-commit hook. The sample prepare-commit-msg comments out the `Conflicts:` part of a merge's commit message; other examples are commented out, including adding a Signed-off-by line at the bottom of the commit messsage, that the user can then edit or discard altogether. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-commit: Refactor creation of log message.Paolo Bonzini2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the code of run_commit, up to writing the trees, editing the message and running the commit-msg hook to prepare_log_message. It also renames the latter to prepare_to_commit. This simplifies a little the code for the next patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-commit: set GIT_EDITOR=: if editor will not be launchedPaolo Bonzini2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparatory patch that provides a simple way for the future prepare-commit-msg hook to discover if the editor will be launched. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | git-commit: support variable number of hook argumentsPaolo Bonzini2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a preparatory patch to allow using run_hook for the prepare-commit-msg hook. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'maint'Junio C Hamano2008-02-16
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: commit: discard index after setting up partial commit filter-branch: handle filenames that need quoting diff: Fix miscounting of --check output hg-to-git: fix parent analysis mailinfo: feed only one line to handle_filter() for QP input diff.c: add "const" qualifier to "char *cmd" member of "struct ll_diff_driver" Add "const" qualifier to "char *excludes_file". Add "const" qualifier to "char *editor_program". Add "const" qualifier to "char *pager_program". config: add 'git_config_string' to refactor string config variables. diff.c: remove useless check for value != NULL fast-import: check return value from unpack_entry() Validate nicknames of remote branches to prohibit confusing ones diff.c: replace a 'strdup' with 'xstrdup'. diff.c: fixup garding of config parser from value=NULL
| * | | commit: discard index after setting up partial commitJeff King2008-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There may still be some entries from the original index that should be discarded before we show the status. In particular, if a file was added in the index but not included in the partial commit, it would still show up in the status listing as staged for commit. Ultimately the correct fix is to keep the two states in separate index_state variables. Then we can avoid having to reload the cache from the temporary file altogether, and just point wt_status_print at the correct index. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'lt/in-core-index'Junio C Hamano2008-02-11
|\ \ \ \ | |/ / / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | * lt/in-core-index: lazy index hashing Create pathname-based hash-table lookup into index read-cache.c: introduce is_racy_timestamp() helper read-cache.c: fix a couple more CE_REMOVE conversion Also use unpack_trees() in do_diff_cache() Make run_diff_index() use unpack_trees(), not read_tree() Avoid running lstat(2) on the same cache entry. index: be careful when handling long names Make on-disk index representation separate from in-core one
| * | Make on-disk index representation separate from in-core oneLinus Torvalds2008-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This converts the index explicitly on read and write to its on-disk format, allowing the in-core format to contain more flags, and be simpler. In particular, the in-core format is now host-endian (as opposed to the on-disk one that is network endian in order to be able to be shared across machines) and as a result we can dispense with all the htonl/ntohl on accesses to the cache_entry fields. This will make it easier to make use of various temporary flags that do not exist in the on-disk format. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | | builtin-commit.c: guard config parser from value=NULLJunio C Hamano2008-02-11
| | | | | | | | | | | | | | | | | | commit.template configuration expects a string value. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | builtin-commit: remove .git/SQUASH_MSG upon successful commitGerrit Pape2008-02-11
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | After doing a merge --squash, and commit afterwards, the commit message template SQUASH_MSG in the git directory is not removed, which means that the content of SQUASH_MSG is used as default commit message for all subsequent commits. So have git commit remove the file SQUASH_MSG from the git directory upon a successful commit. The problem was discovered by Frédéric Brière, reported through http://bugs.debian.org/464656 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Fix "git-commit -C $tag"Junio C Hamano2008-02-03
| | | | | | | | | | | | | | | | The scripted version might not have handled this correctly either, but the version rewritten in C definitely does not grok this and complains $tag is not a commit object. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-commit: exit non-zero if we fail to commit the indexBrandon Casey2008-01-23
|/ | | | | | | | | | | | | | | | | In certain rare cases, the creation of the commit object and update of HEAD can succeed, but then installing the updated index will fail. This is most likely caused by a full disk or exceeded disk quota. When this happens the new index file will be removed, and the repository will be left with the original now-out-of-sync index. The user can recover with a "git reset HEAD" once the disk space issue is resolved. We should detect this failure and offer the user some helpful guidance. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Improve use of lockfile APIBrandon Casey2008-01-16
| | | | | | | Remove remaining double close(2)'s. i.e. close() before commit_locked_index() or commit_lock_file(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make builtin-commit.c more careful about parenthoodLinus Torvalds2008-01-16
| | | | | | | | | | When creating the commit object, be a whole lot more careful about making sure that the parent lines really are valid parent lines. Check things like MERGE_HEAD having proper SHA1 lines in it, and double-check that all the parents exist and are actually commits. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-commit: fix double close(2) that can close a wrong file descriptorKristian Høgsberg2008-01-15
| | | | | | | | | | | | | | | | | | | | | | The codepath to prepare index files for the temporary and next index file was closing file descriptor it obtained from the lockfile API by hand, without letting the API know that the fd should not be doubly closed. This is not usually a problem (except it may get EBADFD) but if we opened another fd for an entirely unrelated purpose (say, an fd used to mmap a packfile) between the time we close the fd to the index file and the time we commit or rollback the lockfile (causing it to also try closing the recorded fd), the lockfile API will close an incorrect file descriptor that is still used for an entirely unrelated purpose. There's four close(fd) calls in prepare_index() and they're all incorrect. The open fd's are cleaned up in rollback_index_files() and shouldn't be closed manually. The patch below gets rid of the extra close() calls and should fix the problem. Signed-off-by: Junio C Hamano <gitster@pobox.com>