]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'pt/enter-repo-comment-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 21 Apr 2015 19:12:23 +0000 (12:12 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Apr 2015 19:12:23 +0000 (12:12 -0700)
Documentation update.

* pt/enter-repo-comment-fix:
  enter_repo(): fix docs to match code

1  2 
path.c

diff --combined path.c
index e6089938018b74fb8a6ea547ffc64d428a13daa0,c480634a314758aab7b7143c401921ba9cf6d1ac..595da81ca67096bae9592d9455bdade442b92628
--- 1/path.c
--- 2/path.c
+++ b/path.c
@@@ -148,12 -148,10 +148,12 @@@ void home_config_paths(char **global, c
                        *global = mkpathdup("%s/.gitconfig", home);
        }
  
 -      if (!xdg_home)
 -              *xdg = NULL;
 -      else
 -              *xdg = mkpathdup("%s/git/%s", xdg_home, file);
 +      if (xdg) {
 +              if (!xdg_home)
 +                      *xdg = NULL;
 +              else
 +                      *xdg = mkpathdup("%s/git/%s", xdg_home, file);
 +      }
  
        free(to_free);
  }
@@@ -277,16 -275,16 +277,16 @@@ char *expand_user_path(const char *path
                        const char *home = getenv("HOME");
                        if (!home)
                                goto return_null;
 -                      strbuf_add(&user_path, home, strlen(home));
 +                      strbuf_addstr(&user_path, home);
                } else {
                        struct passwd *pw = getpw_str(username, username_len);
                        if (!pw)
                                goto return_null;
 -                      strbuf_add(&user_path, pw->pw_dir, strlen(pw->pw_dir));
 +                      strbuf_addstr(&user_path, pw->pw_dir);
                }
                to_copy = first_slash;
        }
 -      strbuf_add(&user_path, to_copy, strlen(to_copy));
 +      strbuf_addstr(&user_path, to_copy);
        return strbuf_detach(&user_path, NULL);
  return_null:
        strbuf_release(&user_path);
   * (3) "relative/path" to mean cwd relative directory; or
   * (4) "/absolute/path" to mean absolute directory.
   *
-  * Unless "strict" is given, we try access() for existence of "%s.git/.git",
-  * "%s/.git", "%s.git", "%s" in this order.  The first one that exists is
-  * what we try.
-  *
-  * Second, we try chdir() to that.  Upon failure, we return NULL.
-  *
-  * Then, we try if the current directory is a valid git repository.
-  * Upon failure, we return NULL.
+  * Unless "strict" is given, we check "%s/.git", "%s", "%s.git/.git", "%s.git"
+  * in this order. We select the first one that is a valid git repository, and
+  * chdir() to it. If none match, or we fail to chdir, we return NULL.
   *
   * If all goes well, we return the directory we used to chdir() (but
   * before ~user is expanded), avoiding getcwd() resolving symbolic
@@@ -824,6 -817,13 +819,6 @@@ int daemon_avoid_alias(const char *p
        }
  }
  
 -int offset_1st_component(const char *path)
 -{
 -      if (has_dos_drive_prefix(path))
 -              return 2 + is_dir_sep(path[2]);
 -      return is_dir_sep(path[0]);
 -}
 -
  static int only_spaces_and_periods(const char *path, size_t len, size_t skip)
  {
        if (len < skip)