summaryrefslogtreecommitdiff
path: root/git.c
AgeCommit message (Collapse)Author
2007-04-14Add basic infrastructure to assign attributes to pathsJunio C Hamano
This adds the basic infrastructure to assign attributes to paths, in a way similar to what the exclusion mechanism does based on $GIT_DIR/info/exclude and .gitignore files. An attribute is just a simple string that does not contain any whitespace. They can be specified in $GIT_DIR/info/attributes file, and .gitattributes file in each directory. Each line in these files defines a pattern matching rule. Similar to the exclusion mechanism, a later match overrides an earlier match in the same file, and entries from .gitattributes file in the same directory takes precedence over the ones from parent directories. Lines in $GIT_DIR/info/attributes file are used as the lowest precedence default rules. A line is either a comment (an empty line, or a line that begins with a '#'), or a rule, which is a whitespace separated list of tokens. The first token on the line is a shell glob pattern. The rest are names of attributes, each of which can optionally be prefixed with '!'. Such a line means "if a path matches this glob, this attribute is set (or unset -- if the attribute name is prefixed with '!'). For glob matching, the same "if the pattern does not have a slash in it, the basename of the path is matched with fnmatch(3) against the pattern, otherwise, the path is matched with the pattern with FNM_PATHNAME" rule as the exclusion mechanism is used. This does not define what an attribute means. Tying an attribute to various effects it has on git operation for paths that have it will be specified separately. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-13handle_options in git wrapper miscounts the options it handled.Matthias Lederhofer
handle_options did not count the number of used arguments correctly. When --git-dir was used the extra argument was not added to the number of handled arguments. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-05Revert "builtin-archive: use RUN_SETUP"René Scharfe
Commit 64edf4b2 cleaned up the initialization of git-archive, at the cost of 'git-archive --list' now requiring a git repo. This patch reverts the cleanup and documents the requirement for this particular dirtyness in a test. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-26use xmalloc in git.c and help.cJames Bowes
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-17Make gc a builtin.James Bowes
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14Merge branch 'jc/fetch'Junio C Hamano
* jc/fetch: .gitignore: add git-fetch--tool builtin-fetch--tool: fix reflog notes. git-fetch: retire update-local-ref which is not used anymore. builtin-fetch--tool: make sure not to overstep ls-remote-result buffer. fetch--tool: fix uninitialized buffer when reading from stdin builtin-fetch--tool: adjust to updated sha1_object_info(). git-fetch--tool takes flags before the subcommand. Use stdin reflist passing in git-fetch.sh Use stdin reflist passing in parse-remote Allow fetch--tool to read from stdin git-fetch: rewrite expand_ref_wildcard in C git-fetch: rewrite another shell loop in C git-fetch: move more code into C. git-fetch--tool: start rewriting parts of git-fetch in C. git-fetch: split fetch_main into fetch_dumb and fetch_native
2007-03-04Make git-revert & git-cherry-pick a builtinJohannes Schindelin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-04Merge branch 'maint'Junio C Hamano
* maint: Unset NO_C99_FORMAT on Cygwin. Fix a "pointer type missmatch" warning. Fix some "comparison is always true/false" warnings. Fix an "implicit function definition" warning. Fix a "label defined but unreferenced" warning. Document the config variable format.suffix git-merge: fail correctly when we cannot fast forward. builtin-archive: use RUN_SETUP Fix git-gc usage note
2007-03-03builtin-archive: use RUN_SETUPJohannes Schindelin
It used to roll its own setup. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28Merge branch 'js/bundle'Junio C Hamano
* js/bundle: bundle: reword missing prerequisite error message git-bundle: record commit summary in the prerequisite data git-bundle: fix 'create --all' git-bundle: avoid fork() in verify_bundle() git-bundle: assorted fixes Add git-bundle: move objects and references by archive
2007-02-27Merge branch 'np/types' into jc/fetchJunio C Hamano
* np/types: (253 commits) get rid of lookup_object_type() convert object type handling from a string to a number formalize typename(), and add its reverse type_from_string() sha1_file.c: don't ignore an error condition in sha1_loose_object_info() sha1_file.c: cleanup "offset" usage sha1_file.c: cleanup hdr usage git-apply: do not fix whitespaces on context lines. diff --cc: integer overflow given a 2GB-or-larger file mailinfo: do not get confused with logical lines that are too long. 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 ...
2007-02-26Merge branch 'master' into js/diff-niJunio C Hamano
* 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-23Add git-bundle: move objects and references by archiveJohannes Schindelin
Some workflows require use of repositories on machines that cannot be connected, preventing use of git-fetch / git-push to transport objects and references between the repositories. git-bundle provides an alternate transport mechanism, effectively allowing git-fetch and git-pull to operate using sneakernet transport. `git-bundle create` allows the user to create a bundle containing one or more branches or tags, but with specified basis assumed to exist on the target repository. At the receiving end, git-bundle acts like git-fetch-pack, allowing the user to invoke git-fetch or git-pull using the bundle file as the URL. git-fetch and git-ls-remote determine they have a bundle URL by checking that the URL points to a file, but are otherwise unchanged in operation with bundles. The original patch was done by Mark Levedahl <mdl123@verizon.net>. It was updated to make git-bundle a builtin, and get rid of the tar format: now, the first line is supposed to say "# v2 git bundle", the next lines either contain a prerequisite ("-" followed by the hash of the needed commit), or a ref (the hash of a commit, followed by the name of the ref), and finally the pack. As a result, the bundle argument can be "-" now. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-23Teach git-diff-files the new option `--no-index`Johannes Schindelin
With this flag and given two paths, git-diff-files behaves as a GNU diff lookalike (plus the git goodies like --check, colour, etc.). This flag is also available in git-diff. It also works outside of a git repository. In addition, if git-diff{,-files} is called without revision or stage parameter, and with exactly two paths at least one of which is not tracked, the default is --no-index. So, you can now say git diff /etc/inittab /etc/fstab and it actually works! This also unifies the duplicated argument parsing between cmd_diff_files() and builtin_diff_files(). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21git grep: use pagerJohannes Schindelin
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21Mechanical conversion to use prefixcmp()Junio C Hamano
This mechanically converts strncmp() to use prefixcmp(), but only when the parameters match specific patterns, so that they can be verified easily. Leftover from this will be fixed in a separate step, including idiotic conversions like if (!strncmp("foo", arg, 3)) => if (!(-prefixcmp(arg, "foo"))) This was done by using this script in px.perl #!/usr/bin/perl -i.bak -p if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) { s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|; } if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) { s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|; } and running: $ git grep -l strncmp -- '*.c' | xargs perl px.perl Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-14git-fetch--tool: start rewriting parts of git-fetch in C.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-14Merge branch 'jc/merge-base' (early part)Junio C Hamano
This contains an evil merge to fast-import, in order to resolve in_merge_bases() update.
2007-02-13Remove git-diff-stages.Junio C Hamano
Signed-off-by: Junio C Hamano <junkio@cox.net>
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-10Make merge-base a built-in.Junio C Hamano
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>