Skip to content
Snippets Groups Projects
Select Git revision
  • v1.0rc3
  • passt default
  • master
  • pu
  • todo
  • next
  • maint
  • v2.8.0-rc1
  • v2.8.0-rc0
  • v2.7.2
  • v2.7.1
  • v2.7.0
  • v2.6.5
  • v2.7.0-rc3
  • v2.7.0-rc2
  • v2.7.0-rc1
  • v2.7.0-rc0
  • v2.6.4
  • v2.6.3
  • v2.6.2
  • v2.6.1
  • v2.3.10
  • v2.5.4
  • v2.4.10
  • v2.6.0
  • v2.6.0-rc3
  • v2.5.3
27 results

git-relink.perl

Blame
    • Junio C Hamano's avatar
      215a7ad1
      Big tool rename. · 215a7ad1
      Junio C Hamano authored
      
      As promised, this is the "big tool rename" patch.  The primary differences
      since 0.99.6 are:
      
        (1) git-*-script are no more.  The commands installed do not
            have any such suffix so users do not have to remember if
            something is implemented as a shell script or not.
      
        (2) Many command names with 'cache' in them are renamed with
            'index' if that is what they mean.
      
      There are backward compatibility symblic links so that you and
      Porcelains can keep using the old names, but the backward
      compatibility support  is expected to be removed in the near
      future.
      
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      215a7ad1
      History
      Big tool rename.
      Junio C Hamano authored
      
      As promised, this is the "big tool rename" patch.  The primary differences
      since 0.99.6 are:
      
        (1) git-*-script are no more.  The commands installed do not
            have any such suffix so users do not have to remember if
            something is implemented as a shell script or not.
      
        (2) Many command names with 'cache' in them are renamed with
            'index' if that is what they mean.
      
      There are backward compatibility symblic links so that you and
      Porcelains can keep using the old names, but the backward
      compatibility support  is expected to be removed in the near
      future.
      
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
    diff-stages.c 2.23 KiB
    /*
     * Copyright (c) 2005 Junio C Hamano
     */
    
    #include "cache.h"
    #include "diff.h"
    
    static struct diff_options diff_options;
    
    static const char diff_stages_usage[] =
    "git-diff-stages [<common diff options>] <stage1> <stage2> [<path>...]"
    COMMON_DIFF_OPTIONS_HELP;
    
    static void diff_stages(int stage1, int stage2)
    {
    	int i = 0;
    	while (i < active_nr) {
    		struct cache_entry *ce, *stages[4] = { NULL, };
    		struct cache_entry *one, *two;
    		const char *name;
    		int len;
    		ce = active_cache[i];
    		len = ce_namelen(ce);
    		name = ce->name;
    		for (;;) {
    			int stage = ce_stage(ce);
    			stages[stage] = ce;
    			if (active_nr <= ++i)
    				break;
    			ce = active_cache[i];
    			if (ce_namelen(ce) != len ||
    			    memcmp(name, ce->name, len))
    				break;
    		}
    		one = stages[stage1];
    		two = stages[stage2];
    		if (!one && !two)
    			continue;
    		if (!one)
    			diff_addremove(&diff_options, '+', ntohl(two->ce_mode),
    				       two->sha1, name, NULL);
    		else if (!two)
    			diff_addremove(&diff_options, '-', ntohl(one->ce_mode),
    				       one->sha1, name, NULL);
    		else if (memcmp(one->sha1, two->sha1, 20) ||
    			 (one->ce_mode != two->ce_mode) ||
    			 diff_options.find_copies_harder)
    			diff_change(&diff_options,
    				    ntohl(one->ce_mode), ntohl(two->ce_mode),
    				    one->sha1, two->sha1, name, NULL);
    	}
    }
    
    int main(int ac, const char **av)
    {
    	int stage1, stage2;
    
    	read_cache();
    	diff_setup(&diff_options);
    	while (1 < ac && av[1][0] == '-') {
    		const char *arg = av[1];
    		if (!strcmp(arg, "-r"))
    			; /* as usual */
    		else {
    			int diff_opt_cnt;
    			diff_opt_cnt = diff_opt_parse(&diff_options,
    						      av+1, ac-1);
    			if (diff_opt_cnt < 0)
    				usage(diff_stages_usage);
    			else if (diff_opt_cnt) {