summaryrefslogtreecommitdiff
path: root/git.c
AgeCommit message (Collapse)Author
2007-02-11Allow aliases to expand to shell commandsTheodore Ts'o
If the alias expansion is prefixed with an exclamation point, treat it as a shell command which is run using system(3). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-11Print a sane error message if an alias expands to an invalid git commandTheodore Ts'o
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-05Commands requiring a work tree must not run in GIT_DIRJohannes Schindelin
This patch helps when you accidentally run something like git-clean in the git directory instead of the work tree. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-29Make fsck and fsck-objects be builtins.Mark Wooding
The earlier change df391b192 to rename fsck-objects to fsck broke fsck-objects. This should fix it again. Signed-off-by: Mark Wooding <mdw@distorted.org.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-29[PATCH] Rename git-repo-config to git-config.Tom Prince
Signed-off-by: Tom Prince <tom.prince@ualberta.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28git-blame --incremental: don't use pagerRen,Ai(B Scharfe
Starting a pager defeats the purpose of the incremental output mode. This changes git-blame to only paginate if --incremental was not given. git -p blame --incremental still starts the pager, though. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24annotate: use pagerJohannes Schindelin
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12Merge branch 'jc/bare'Junio C Hamano
* 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-10Disallow working directory commands in a bare repository.Shawn O. Pearce
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-10Make git-describe a builtin.Shawn O. Pearce
Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08"init-db" can really be just "init"Nicolas Pitre
Make "init" the equivalent of "init-db". This should make first GIT impression a little more friendly. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-31Replace "GIT_DIR" with GIT_DIR_ENVIRONMENT.Shawn O. Pearce
We tend to use the nice constant GIT_DIR_ENVIRONMENT when we are referring to the "GIT_DIR" constant, but git.c didn't do so. Now it does. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-31Use PATH_MAX constant for --bare.Shawn O. Pearce
For easier portability we prefer PATH_MAX over seemingly random constants like 1024. Make it so. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-27Merge branch 'jc/fsck-reflog'Junio C Hamano
* jc/fsck-reflog: Add git-reflog to .gitignore reflog expire: do not punt on tags that point at non commits. reflog expire: prune commits that are not incomplete Don't crash during repack of a reflog with pruned commits. git reflog expire Move in_merge_bases() to commit.c reflog: fix warning message. Teach git-repack to preserve objects referred to by reflog entries. Protect commits recorded in reflog from pruning. add for_each_reflog_ent() iterator
2006-12-24Merge branch 'js/rerere'Junio C Hamano
* js/rerere: Make git-rerere a builtin Add a test for git-rerere move read_mmfile() into xdiff-interface
2006-12-23Keep "git --git-dir" from causing a bus error.Brian Gernhardt
The option checking code for --git-dir had an off by 1 error that would cause it to access uninitialized memory if it was the last argument. This causes it to display an error and display the usage string instead. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22Make git-rerere a builtinJohannes Schindelin
The perl version used modules which are non-standard in some setups. This patch brings the full power of rerere to a wider audience. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-21git reflog expireJunio C Hamano
This prepares a place to collect reflog management subcommands, and implements "expire" action. $ git reflog expire --dry-run \ --expire=4.weeks \ --expire-unreachable=1.week \ refs/heads/master The expiration uses two timestamps: --expire and --expire-unreachable. Entries older than expire time (defaults to 90 days), and entries older than expire-unreachable time (defaults to 30 days) and records a commit that has been rewound and made unreachable from the current tip of the ref are removed from the reflog. The parameter handling is still rough, but I think the core logic for expiration is already sound. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20simplify inclusion of system header files.Junio C Hamano
This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-06Add builtin merge-file, a minimal replacement for RCS mergeJohannes Schindelin
merge-file has the same syntax as RCS merge, but supports only the "-L" option. For good measure, a test is added, which is quite minimal, though. [jc: further fix for compliation errors included.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-28shortlog: use pagerJohannes Schindelin
On request of the kingpenguin, shortlog now uses the pager if output goes to a tty. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-20Build in shortlogJohannes Schindelin
[jc: with minimum squelching of compiler warning under "-pedantic" compilation options.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-09git-pickaxe: retire pickaxeJunio C Hamano
Just make it take over blame's place. Documentation and command have all stopped mentioning "git-pickaxe". The built-in synonym is left in the command table, so you can still say "git pickaxe", but it probably is a good idea to retire it as well. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-08Merge branch 'jc/pickaxe'Junio C Hamano
2006-11-01branch: work in subdirectories.Junio C Hamano
Noticed by Andy Whitcroft Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-01Merge branch 'rs/cherry'Junio C Hamano
* rs/cherry: Make git-cherry handle root trees Built-in cherry
2006-11-01Merge branch 'lj/refs'Junio C Hamano
* 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-10-25Merge for-each-ref to sync gitweb fully with 'next'Junio C Hamano
2006-10-25Merge branch 'jc/web-blame'Junio C Hamano
* jc/web-blame: gitweb: spell "blame --porcelain" with -p blame: Document and add help text for -f, -n, and -p gitweb: blame porcelain: lineno and orig lineno swapped Remove git-annotate.perl and create a builtin-alias for git-blame gitweb: use blame --porcelain git-blame --porcelain blame.c: move code to output metainfo into a separate function. git-blame: --show-number (and -n) git-blame: --show-name (and -f) blame.c: whitespace and formatting clean-up. Gitweb - provide site headers and footers gitweb: blame: Mouse-over commit-8 shows author and date gitweb: blame: print commit-8 on the leading row of a commit-block Revert 954a6183756a073723a7c9fd8d2feb13132876b0 gitweb: prepare for repositories with packed refs. gitweb: make leftmost column of blame less cluttered.
2006-10-24Make git-branch a builtinLars Hjemli
This replaces git-branch.sh with builtin-branch.c The changes is basically a patch from Kristian Høgsberg, updated to apply onto current 'next' Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-24Built-in cherryRene Scharfe
This replaces the shell script git-cherry with a version written in C. The behaviour of the new version differs from the original in two points: it has no long help any more, and it is handling the (optional) third parameter a bit differently. Basically, it does the equivalent of ours=`git-rev-list $ours ^$limit ^$upstream` instead of ours=`git-rev-list $ours ^$limit` Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-21git-pickaxe: pagenate output by default.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20git-pickaxe: blame rewritten.Junio C Hamano
Currently it does what git-blame does, but only faster. More importantly, its internal structure is designed to support content movement (aka cut-and-paste) more easily by allowing more than one paths to be taken from the same commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-11paginate git-diff by defaultMartin Waitz
2006-10-10Remove git-annotate.perl and create a builtin-alias for git-blameRyan Anderson
Signed-off-by: Ryan Anderson <ryan@michonline.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-08git-tar-tree: don't RUN_SETUPRene Scharfe
Noted by Jiri Slaby, git-tar-tree --remote doesn't need to be run from inside of a git archive. Since git-tar-tree is now only a wrapper for git-archive, which calls setup_git_directory() as needed, we should drop the flag RUN_SETUP. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-04Fix usage string to match that given in the man pageAlan Chandler
Still not managed to understand git-send-mail sufficiently well to not accidently miss of this list when I sending it to Junio Signed-off-by: Alan Chandler <alan@chandlerfamily.org.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28Merge branch 'master' into lj/refsJunio C Hamano
* master: (72 commits) runstatus: do not recurse into subdirectories if not needed grep: fix --fixed-strings combined with expression. grep: free expressions and patterns when done. Corrected copy-and-paste thinko in ignore executable bit test case. An illustration of rev-list --parents --pretty=raw Allow git-checkout when on a non-existant branch. gitweb: Decode long title for link tooltips git-svn: Fix fetch --no-ignore-externals with GIT_SVN_NO_LIB=1 Ignore executable bit when adding files if filemode=0. Remove empty ref directories that prevent creating a ref. Use const for interpolate arguments git-archive: update documentation Deprecate merge-recursive.py gitweb: fix over-eager application of esc_html(). Allow '(no author)' in git-svn's authors file. Allow 'svn fetch' on '(no date)' revisions in Subversion. git-repack: allow git-repack to run in subdirectory Remove upload-tar and make git-tar-tree a thin wrapper to git-archive git-tar-tree: Move code for git-archive --format=tar to archive-tar.c git-tar-tree: Remove duplicate git_config() call ...
2006-09-27Merge branch 'jc/lt-ref2-with-lt-refs' into jc/ref-lockingJunio C Hamano
* jc/lt-ref2-with-lt-refs: Fix show-ref usage for --dereference. Document git-show-ref [-s|--hash] option. Add man page for git-show-ref gitignore: git-show-ref is a generated file. Use Linus' show ref in "git-branch.sh". Add [-s|--hash] option to Linus' show-ref. Teach "git checkout" to use git-show-ref Add "git show-ref" builtin command
2006-09-25Remove upload-tar and make git-tar-tree a thin wrapper to git-archiveJunio C Hamano
The command now issues a big deprecation warning message and runs git-archive command with appropriate arguments. git-tar-tree $tree_ish $base always forces $base to be the leading directory name, so the --prefix parameter passed internally to git-archive is a slash appended to it, i.e. "--prefix=$base/". Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-23Remove git-zip-treeRene Scharfe
git-zip-tree can be safely removed because it was never part of a formal release. This patch makes 'git-archive --format=zip' the one and only git ZIP file creation command. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-21Merge branch 'lt/refs' into jc/lt-ref2-with-lt-refsJunio C Hamano
* lt/refs: (58 commits) git-pack-refs --prune pack-refs: do not pack symbolic refs. Tell between packed, unpacked and symbolic refs. Add callback data to for_each_ref() family. symbolit-ref: fix resolve_ref conversion. Fix broken sha1 locking fsck-objects: adjust to resolve_ref() clean-up. gitignore: git-pack-refs is a generated file. wt-status: use simplified resolve_ref to find current branch Fix t1400-update-ref test minimally Enable the packed refs file format Make ref resolution saner Add support for negative refs Start handling references internally as a sorted in-memory list gitweb fix validating pg (page) parameter git-repack(1): document --window and --depth git-apply(1): document --unidiff-zero gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export upload-archive: monitor child communication even more carefully. gitweb: export options ...
2006-09-21Merge branch 'lt/refs' into jc/for-each-ref-with-lt-refsJunio C Hamano
* lt/refs: (58 commits) git-pack-refs --prune pack-refs: do not pack symbolic refs. Tell between packed, unpacked and symbolic refs. Add callback data to for_each_ref() family. symbolit-ref: fix resolve_ref conversion. Fix broken sha1 locking fsck-objects: adjust to resolve_ref() clean-up. gitignore: git-pack-refs is a generated file. wt-status: use simplified resolve_ref to find current branch Fix t1400-update-ref test minimally Enable the packed refs file format Make ref resolution saner Add support for negative refs Start handling references internally as a sorted in-memory list gitweb fix validating pg (page) parameter git-repack(1): document --window and --depth git-apply(1): document --unidiff-zero gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export upload-archive: monitor child communication even more carefully. gitweb: export options ...
2006-09-18Start handling references internally as a sorted in-memory listLinus Torvalds
This also adds some very rudimentary support for the notion of packed refs. HOWEVER! At this point it isn't used to actually look up a ref yet, only for listing them (ie "for_each_ref()" and friends see the packed refs, but none of the other single-ref lookup routines). Note how we keep two separate lists: one for the loose refs, and one for the packed refs we read. That's so that we can easily keep the two apart, and read only one set or the other (and still always make sure that the loose refs take precedence). [ From this, it's not actually obvious why we'd keep the two separate lists, but it's important to have the packed refs on their own list later on, when I add support for looking up a single loose one. For that case, we will want to read _just_ the packed refs in case the single-ref lookup fails, yet we may end up needing the other list at some point in the future, so keeping them separated is important ] Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-18Merge branch 'jk/diff'Junio C Hamano
* jk/diff: wt-status: remove extraneous newline from 'deleted:' output git-status: document colorization config options Teach runstatus about --untracked git-commit.sh: convert run_status to a C builtin Move color option parsing out of diff.c and into color.[ch] diff: support custom callbacks for output
2006-09-17Merge branch 'jc/archive'Junio C Hamano
* jc/archive: git-tar-tree: devolve git-tar-tree into a wrapper for git-archive git-archive: inline default_parse_extra() builtin-archive.c: rename remote_request() to extract_remote_arg() upload-archive: monitor child communication more carefully. Add sideband status report to git-archive protocol Prepare larger packet buffer for upload-pack protocol. Teach --exec to git-archive --remote Add --verbose to git-archive archive: force line buffered output to stderr Use xstrdup instead of strdup in builtin-{tar,zip}-tree.c Move sideband server side support into reusable form. Move sideband client side support into reusable form. archive: allow remote to have more formats than we understand. git-archive: make compression level of ZIP archives configurable Add git-upload-archive git-archive: wire up ZIP format. git-archive: wire up TAR format. Add git-archive
2006-09-16Add git-for-each-ref: helper for language bindingsJunio C Hamano
This adds a new command, git-for-each-ref. You can have it iterate over refs and have it output various aspects of the objects they refer to. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-16Add "git show-ref" builtin commandLinus Torvalds
It's kind of like "git peek-remote", but works only locally (and thus avoids the whole overhead of git_connect()) and has some extra verification features. For example, it allows you to filter the results, and to choose whether you want the tag dereferencing or not. You can also use it to just test whether a particular ref exists. For example: git show-ref master will show all references called "master", whether tags or heads or anything else, and regardless of how deep in the reference naming hierarchy they are (so it would show "refs/heads/master" but also "refs/remote/other-repo/master"). When using the "--verify" flag, the command requires an exact ref path: git show-ref --verify refs/heads/master will only match the exact branch called "master". If nothing matches, show-ref will return an error code of 1, and in the case of verification, it will show an error message. For scripting, you can ask it to be quiet with the "--quiet" flag, which allows you to do things like git-show-ref --quiet --verify -- "refs/heads/$headname" || echo "$headname is not a valid branch" to check whether a particular branch exists or not (notice how we don't actually want to show any results, and we want to use the full refname for it in order to not trigger the problem with ambiguous partial matches). To show only tags, or only proper branch heads, use "--tags" and/or "--heads" respectively (using both means that it shows tags _and_ heads, but not other random references under the refs/ subdirectory). To do automatic tag object dereferencing, use the "-d" or "--dereference" flag, so you can do git show-ref --tags --dereference to get a listing of all tags together with what they dereference. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14Handle invalid argc gentlyDmitry V. Levin
describe, git: Handle argc==0 case the same way as argc==1. merge-tree: Refuse excessive arguments. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-14Make count-objects, describe and merge-tree work in subdirectoryDmitry V. Levin
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>