Skip to content

Commit 55524fc

Browse files
committed
Merge branch 'maint'
* maint: completion: add missing options to show-branch and show dir.c: clean up handling of 'path' parameter in read_directory_recursive() Fix type-punning issues
2 parents 671d1bc + 076c323 commit 55524fc

4 files changed

Lines changed: 8 additions & 5 deletions

File tree

contrib/completion/git-completion.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@ _git_show ()
18371837
return
18381838
;;
18391839
--*)
1840-
__gitcomp "--pretty= --format=
1840+
__gitcomp "--pretty= --format= --abbrev-commit --oneline
18411841
$__git_diff_common_options
18421842
"
18431843
return
@@ -1854,7 +1854,7 @@ _git_show_branch ()
18541854
__gitcomp "
18551855
--all --remotes --topo-order --current --more=
18561856
--list --independent --merge-base --no-name
1857-
--sha1-name --topics --reflog
1857+
--sha1-name --sparse --topics --reflog
18581858
"
18591859
return
18601860
;;

decorate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
static unsigned int hash_obj(const struct object *obj, unsigned int n)
1010
{
11-
unsigned int hash = *(unsigned int *)obj->sha1;
11+
unsigned int hash;
12+
13+
memcpy(&hash, obj->sha1, sizeof(unsigned int));
1214
return hash % n;
1315
}
1416

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static int get_dtype(struct dirent *de, const char *path)
576576
*/
577577
static int read_directory_recursive(struct dir_struct *dir, const char *path, const char *base, int baselen, int check_only, const struct path_simplify *simplify)
578578
{
579-
DIR *fdir = opendir(path);
579+
DIR *fdir = opendir(*path ? path : ".");
580580
int contents = 0;
581581

582582
if (fdir) {

object.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ int type_from_string(const char *str)
4545

4646
static unsigned int hash_obj(struct object *obj, unsigned int n)
4747
{
48-
unsigned int hash = *(unsigned int *)obj->sha1;
48+
unsigned int hash;
49+
memcpy(&hash, obj->sha1, sizeof(unsigned int));
4950
return hash % n;
5051
}
5152

0 commit comments

Comments
 (0)