git-2.22.0/diff-no-index.c
/* append basename of F to D */
append basename of F to D
append basename of F to D
static void append_basename(struct strbuf *path, const char *dir, const char *file)
{
	const char *tail = strrchr(file, '/');
	strbuf_addstr(path, dir);
	while (path->len && path->buf[path->len - 1] == '/')
		path->len--;
	strbuf_addch(path, '/');
	strbuf_addstr(path, tail ? tail + 1 : file);
}
static void append_basename ( struct strbuf * path , const char * dir , const char * file ) { const char * tail = strrchr ( file , ' ' ) ; strbuf_addstr ( path , dir ) ; while ( path -> len && path -> buf [ path -> len - 1 ] == ' ' ) path -> len -- ; strbuf_addch ( path , ' ' ) ; strbuf_addstr ( path , tail ? tail + 1 : file ) ; }
append basename of F to D
append basename of F to D