Commit graph

188 commits

Author SHA1 Message Date
Junio C Hamano 048f48a2fd Merge branch 'master' into js/diff-ni
* 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-26 01:20:42 -08:00
Johannes Schindelin d516c2d119 Teach git-diff-files the new option --no-index
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-22 20:59:55 -08:00
Johannes Schindelin 34c6a82b8a git grep: use pager
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-20 22:44:35 -08:00
Junio C Hamano cc44c7655f Mechanical conversion to use prefixcmp()
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-20 22:03:15 -08:00
Junio C Hamano 4a164d48df Merge branch 'jc/merge-base' (early part)
This contains an evil merge to fast-import, in order to
resolve in_merge_bases() update.
2007-02-13 16:54:35 -08:00
Junio C Hamano 4cc41a16c1 Remove git-diff-stages.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-12 19:33:03 -08:00
Theodore Ts'o dfd42a3c62 Allow aliases to expand to shell commands
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-10 22:46:34 -08:00
Theodore Ts'o f3dd015c91 Print a sane error message if an alias expands to an invalid git command
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-10 22:46:30 -08:00
Johannes Schindelin 6d9ba67b0f Commands requiring a work tree must not run in GIT_DIR
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-02-05 14:02:16 -08:00
Mark Wooding b4dfefe00f Make fsck and fsck-objects be builtins.
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 09:36:21 -08:00
Tom Prince e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Ren,Ai(B Scharfe 4f0219a4c7 git-blame --incremental: don't use pager
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-28 11:00:57 -08:00
Johannes Schindelin e955ae957c annotate: use pager
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24 15:08:31 -08:00
Junio C Hamano e861ce1692 Merge branch 'jc/bare'
* 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-11 16:50:36 -08:00
Shawn O. Pearce 7eff28a9b4 Disallow working directory commands in a bare repository.
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-10 15:03:09 -08:00
Shawn O. Pearce 9a0eaf83ea Make git-describe a builtin.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 08:27:01 -08:00
Junio C Hamano 71dfbf224f Make merge-base a built-in.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-09 17:57:03 -08:00
Nicolas Pitre 515377ea9e "init-db" can really be just "init"
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>
2007-01-07 18:03:07 -08:00
Shawn O. Pearce 45b097947d Replace "GIT_DIR" with GIT_DIR_ENVIRONMENT.
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-30 22:22:13 -08:00
Shawn O. Pearce ef5ddb2fe0 Use PATH_MAX constant for --bare.
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-30 22:22:13 -08:00
Junio C Hamano e8b4029f99 Merge branch 'jc/fsck-reflog'
* 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-26 23:47:40 -08:00
Junio C Hamano 9def2138a1 Merge branch 'js/rerere'
* js/rerere:
  Make git-rerere a builtin
  Add a test for git-rerere
  move read_mmfile() into xdiff-interface
2006-12-24 02:10:55 -08:00
Brian Gernhardt c321f00d09 Keep "git --git-dir" from causing a bus error.
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-22 23:17:20 -08:00
Johannes Schindelin 658f365027 Make git-rerere a builtin
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-21 23:10:14 -08:00
Junio C Hamano 4264dc15e1 git reflog expire
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-20 17:22:10 -08:00
Junio C Hamano 85023577a8 simplify inclusion of system header files.
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-20 09:51:35 -08:00
Johannes Schindelin ba1f5f3537 Add builtin merge-file, a minimal replacement for RCS merge
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-12-06 10:00:24 -08:00
Johannes Schindelin 1d541c120b shortlog: use pager
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-27 16:55:42 -08:00
Johannes Schindelin b8ec59234b Build in shortlog
[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-19 22:59:05 -08:00
Junio C Hamano acca687fa9 git-pickaxe: retire pickaxe
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-08 18:49:37 -08:00
Junio C Hamano 24ad8e0ce2 Merge branch 'jc/pickaxe' 2006-11-07 16:33:59 -08:00
Junio C Hamano 1da1b3a3e0 branch: work in subdirectories.
Noticed by Andy Whitcroft

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-01 12:53:13 -08:00
Junio C Hamano 56532fa147 Merge branch 'rs/cherry'
* rs/cherry:
  Make git-cherry handle root trees
  Built-in cherry
2006-11-01 09:17:37 -08:00
Junio C Hamano 58a1e0e83b Merge branch 'lj/refs'
* 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-11-01 08:48:50 -08:00
Junio C Hamano 9ee93dceb5 Merge for-each-ref to sync gitweb fully with 'next' 2006-10-25 13:29:12 -07:00
Junio C Hamano 8e95026f29 Merge branch 'jc/web-blame'
* 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 954a618375
  gitweb: prepare for repositories with packed refs.
  gitweb: make leftmost column of blame less cluttered.
2006-10-25 13:18:06 -07:00
Lars Hjemli c31820c26b Make git-branch a builtin
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-23 20:43:49 -07:00
Rene Scharfe e827633a5d Built-in cherry
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-23 20:25:32 -07:00
Junio C Hamano 1617baa587 git-pickaxe: pagenate output by default.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-20 18:37:10 -07:00
Junio C Hamano cee7f245dc git-pickaxe: blame rewritten.
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-19 22:42:49 -07:00
Martin Waitz e88ee29154 paginate git-diff by default 2006-10-10 17:58:34 -07:00
Ryan Anderson f789e34746 Remove git-annotate.perl and create a builtin-alias for git-blame
Signed-off-by: Ryan Anderson <ryan@michonline.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-09 20:25:28 -07:00
Rene Scharfe 9cb90b80fc git-tar-tree: don't RUN_SETUP
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-08 12:43:07 -07:00
Alan Chandler 281e67d6fa Fix usage string to match that given in the man page
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-10-03 23:58:38 -07:00
Junio C Hamano 2958d9b5db Merge branch 'master' into lj/refs
* 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-27 22:23:12 -07:00
Junio C Hamano e9800b28c2 Merge branch 'jc/lt-ref2-with-lt-refs' into jc/ref-locking
* 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-27 00:53:29 -07:00
Junio C Hamano fd88d9c81e Remove upload-tar and make git-tar-tree a thin wrapper to git-archive
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-24 19:55:08 -07:00
Rene Scharfe 31756c5da8 Remove git-zip-tree
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-23 14:00:27 -07:00
Junio C Hamano eaf12a8c7d Merge branch 'lt/refs' into jc/lt-ref2-with-lt-refs
* 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-21 00:40:28 -07:00
Junio C Hamano 340adb8bcc Merge branch 'lt/refs' into jc/for-each-ref-with-lt-refs
* 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-21 00:29:37 -07:00