Re: [PATCH] Teach git-diff{,-files} the new option `--no-index`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, 22 Feb 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> > +int run_diff_files(struct rev_info *revs, int argc, const char **argv)
> >  {
> >  	int entries, i;
> > +	int diff_unmerged_stage;
> > +	int silent_on_removed;
> > +
> > +	if (handle_diff_files_args(revs, argc, argv, &silent_on_removed))
> > +		return -1;
> > +
> > +	diff_unmerged_stage = revs->max_count;
> > +
> > +	if (revs->max_count == -2) {
> > +		if (revs->diffopt.nr_paths != 2)
> > +			return error("need two files/directories with --no-index");
> > +		queue_diff(&revs->diffopt, revs->diffopt.paths[0],
> > +				revs->diffopt.paths[1]);
> > +		diffcore_std(&revs->diffopt);
> > +		diff_flush(&revs->diffopt);
> > +		return 0;
> > +	}
> 
> I do not mind the "max_count == -2 is some magic" hack too much,
> but I do not think it belongs to a generic service function
> whose purpose is to run "diff-files" aka "diff between index and
> working tree".  run_diff_files() is used by other applications
> (most notably wt-status) for example, and I expect we would need
> that when we rewrite git-commit itself in C.

Well, the alternative is to duplicate code, as you need both the option 
parsing and the special handling of max_count==-2 in both builtin-diff.c 
and builtin-diff-files.c.

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]