aboutsummaryrefslogtreecommitdiff
path: root/git.c
Commit message (Collapse)AuthorAge
...
* | Make count-objects, describe and merge-tree work in subdirectoryDmitry V. Levin2006-09-13
|/ | | | | | | Call setup_git_directory() to make these commands work in subdirectory. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix memory leak in prepend_to_path (git.c).Christian Couder2006-09-05
| | | | | | | | Some memory was allocated for a new path but not freed after the path was used. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Trace into a file or an open fd and refactor tracing code.Christian Couder2006-09-02
| | | | | | | | | | | | | | | | | | | | | | | If GIT_TRACE is set to an absolute path (starting with a '/' character), we interpret this as a file path and we trace into it. Also if GIT_TRACE is set to an integer value greater than 1 and lower than 10, we interpret this as an open fd value and we trace into it. Note that this behavior is not compatible with the previous one. We also trace whole messages using one write(2) call to make sure messages from processes do net get mixed up in the middle. This patch makes it possible to get trace information when running "make test". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Replace uses of strdup with xstrdup.Shawn Pearce2006-09-02
| | | | | | | | | | | | | | | | Like xmalloc and xrealloc xstrdup dies with a useful message if the native strdup() implementation returns NULL rather than a valid pointer. I just tried to use xstrdup in new code and found it to be missing. However I expected it to be present as xmalloc and xrealloc are already commonly used throughout the code. [jc: removed the part that deals with last_XXX, which I am finding more and more dubious these days.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use xmalloc instead of mallocJonas Fonseca2006-08-31
| | | | | Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add git-zip-treeRene Scharfe2006-08-26
| | | | | | | | | | | | | | | | | | In the Windows world ZIP files are better supported than tar files. Windows even includes built-in support for ZIP files nowadays. git-zip-tree is similar to git-tar-tree; it creates ZIP files out of git trees. It stores the commit ID (if available) in a ZIP file comment which can be extracted by unzip. There's still quite some room for improvement: this initial version supports no symlinks, calls write() way too often (three times per file) and there is no unit test. [jc: with a minor typefix to avoid void* arithmetic] Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use xrealloc instead of reallocJonas Fonseca2006-08-26
| | | | | | | | | Change places that use realloc, without a proper error path, to instead use xrealloc. Drop an erroneous error path in the daemon code that used errno in the die message in favour of the simpler xrealloc. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* remove ugly shadowing of loop indexes in subloops.Pierre Habouzit2006-08-23
| | | | | | | | builtin-mv.c and git.c has a nested loop that is governed by a variable 'i', but they shadow it with another instance of 'i'. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* remove unnecessary initializationsDavid Rientjes2006-08-15
| | | | | | | | [jc: I needed to hand merge the changes to the updated codebase, so the result needs to be checked.] Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-verify-pack: make builtinRene Scharfe2006-08-10
| | | | | | | | Convert git-verify-pack to a builtin command. Also rename ac to argc and av to argv for consistancy. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'master' into mk/renameJunio C Hamano2006-08-08
|\
| * git-push: allow pushing from subdirectoriesJeff King2006-08-08
| | | | | | | | | | | | | | | | The semantics are equivalent to pushing from the root; we just try harder to find the .git directory. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git.c: Rename NEEDS_PREFIX to RUN_SETUPJunio C Hamano2006-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | As Matthias Kestenholz noted, the flag does not quite mean "needs prefix" -- it is more like "run setup_git_directory() before running this command", so rename it to avoid future confusion. While we are at it, rewrite the definition of options to make it obvious that we are talking about flag bits by using standard (1<<n) notation. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | builtins: Makefile clean-upJunio C Hamano2006-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This cleans up the build procedure for built-in commands by: - generating mostly redundant definition of BUILT_INS from BUILTIN_OBJS in the Makefile, - renaming a few files to make the above possible, and - sorting the built-in command table in git.c. It might be a good idea to binary search (or perfect hash) the built-in command table, but that can be done later when somebody feels like. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-checkout-index a builtinJunio C Hamano2006-08-04
| | | | | | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-symbolic-ref a builtinMatthias Kestenholz2006-08-03
| | | | | | | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-unpack-objects a builtinMatthias Kestenholz2006-08-03
| | | | | | | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-pack-objects a builtinMatthias Kestenholz2006-08-03
| | | | | | | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-name-rev a builtinMatthias Kestenholz2006-08-03
|/ | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-repo-config a builtinMatthias Kestenholz2006-08-02
| | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-prune-packed a builtinMatthias Kestenholz2006-08-02
| | | | | Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Remove cmd_usage() routine and re-organize the help/usage code.Ramsay Allan Jones2006-08-02
| | | | | | | | | | | | | | | | The cmd_usage() routine was causing warning messages due to a NULL format parameter being passed in three out of four calls. This is a problem if you want to compile with -Werror. A simple solution is to simply remove the GNU __attribute__ format pragma from the cmd_usage() declaration in the header file. The function interface was somewhat muddled anyway, so re-write the code to finesse the problem. [jc: this incidentally revealed that t9100 test assumed that the output from "git help" to be fixed in stone, but this patch lower-cases "Usage" to "usage". Update the test not to rely on "git help" output.] Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Builtins: control the use of pager from the command table.Junio C Hamano2006-07-31
| | | | | | | | | | | | This moves the built-in "always-use-pager" logic for log family to the command dispatch table of git wrapper. This makes it easier to change the default use of pager, and has an added benefit that we fork and exec the pager early before packs are mmapped. Pointed out by Juergen Ruehle <j.ruehle@bmiag.de>. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git.c: allow alias expansion without a git directoryMatthias Lederhofer2006-07-30
| | | | | | | | | | With this, the configuration mechanism can be used to say: [alias] init = init-db --template=/path/to/template Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'lt/setup' into __/setup-n-mvJunio C Hamano2006-07-29
|\ | | | | | | | | | | | | This merges the new built-in calling convention code into Johannes's builtin-mv topic in order to resolve their conflicts early on. Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Call setup_git_directory() much earlierLinus Torvalds2006-07-29
| | | | | | | | | | | | | | | | | | This changes the calling convention of built-in commands and passes the "prefix" (i.e. pathname of $PWD relative to the project root level) down to them. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * git wrapper: add --git-dir=<path> and --bare optionsJohannes Schindelin2006-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this, you can say git --bare repack -a -d inside a bare repository, and it will actually work. While at it, also move the --version, --help and --exec-path options to the handle_options() function. While at documenting the new options, also document the --paginate option. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
| * Allow an alias to start with "-p"Johannes Schindelin2006-07-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now, something like [alias] pd = -p diff works as expected. [jc: a follow-up fix from Jeff King folded in.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Make git-mv a builtinJohannes Schindelin2006-07-26
|/ | | | | | | | This also moves add_file_to_index() to read-cache.c. Oh, and while touching builtin-add.c, it also removes a duplicate git_config() call. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* argv created by handle_alias should be NULL terminatedMatthias Lederhofer2006-07-14
| | | | | Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'ml/trace'Junio C Hamano2006-07-12
|\ | | | | | | | | | | | | * ml/trace: test-lib: unset GIT_TRACE GIT_TRACE: fix a mixed declarations and code warning GIT_TRACE: show which built-in/external commands are executed
| * GIT_TRACE: show which built-in/external commands are executedMatthias Lederhofer2006-07-09
| | | | | | | | | | | | | | | | | | | | | | With the environment variable GIT_TRACE set git will show - alias expansion - built-in command execution - external command execution on stderr. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge branch 'lt/prune'Junio C Hamano2006-07-12
|\ \ | | | | | | | | | | | | * lt/prune: builtin "git prune"
| * | builtin "git prune"Linus Torvalds2006-07-09
| |/ | | | | | | | | | | | | | | | | | | | | | | | | This actually removes the objects to be pruned, unless you specify "-n" (at which point it will just tell you which files it would prune). This doesn't do the pack-file pruning that the shell-script used to do, but if somebody really wants to, they could add it easily enough. I wonder how useful it is, though, considering that "git repack -a -d" is just a lot more efficient and generates a better end result. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | "git -p cmd" to page anywhereJunio C Hamano2006-07-09
|/ | | | | | | | | | | | | This allows you to say: git -p diff v2.6.16-rc5.. and the command pipes the output of any git command to your pager. [jc: this resurrects a month old RFC patch with improvement suggested by Linus to call it --paginate instead of --less.] Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-fmt-merge-msg a builtinJohannes Schindelin2006-07-03
| | | | | Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Save errno in handle_alias()Johannes Schindelin2006-06-28
| | | | | | | | | | git.c:main() relies on the value of errno being set by the last attempt to execute the command. However, if something goes awry in handle_alias(), that assumption is wrong. So restore errno before returning from handle_alias(). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make some strings constTimo Hirvonen2006-06-28
| | | | | Signed-off-by: Timo Hirvonen <tihirvon@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git wrapper: fix command name in an error message.Andreas Ericsson2006-06-28
| | | | | | | | When the command execution by execv_git_cmd() fails with an errno other than ENOENT, we used an uninitialized variable instead of the string that holds the command name to report what failed. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-update-ref a builtinLukas Sandström2006-06-18
| | | | | Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-update-index a builtinLukas Sandström2006-06-18
| | | | | Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-stripspace a builtinLukas Sandström2006-06-18
| | | | | Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-mailinfo a builtinLukas Sandström2006-06-18
| | | | | | | [jc: with a bit of constness tightening] Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-mailsplit a builtinLukas Sandström2006-06-18
| | | | | Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-write-tree a builtinLukas Sandström2006-06-18
| | | | | Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* fix git aliasJunio C Hamano2006-06-16
| | | | | | | | | When extra command line arguments are given to a command that was alias-expanded, the code generated a wrong argument list, leaving the original alias in the result, and forgetting to terminate the new argv list. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Built-in git-get-tar-commit-idRene Scharfe2006-06-10
| | | | | | | | | | | | By being an internal command git-get-commit-id can make use of struct ustar_header and other stuff and stops wasting precious disk space. Note: I recycled one of the two "tar-tree" entries instead of splitting that cleanup into a separate patch. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git alias: try alias last.Junio C Hamano2006-06-05
| | | | | | | | | | This disables alias "foo" from being used for git-foo, and when we do use alias we check the built-in and then existing command names first and then alias as the fallback. This avoids the problem of common commands used in scripts getting clobbered by user specific aliases. Signed-off-by: Junio C Hamano <junkio@cox.net>
* If you have a config containing something like this:Johannes Schindelin2006-06-05
| | | | | | | | | | | | | | | | [alias] l = "log --stat -M ORIG_HEAD.." you can call git l and it will do the same as git log --stat -M ORIG_HEAD.. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Builtin git-rev-parse.Christian Couder2006-06-03
| | | | | Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>