logo

Crowdly

Lorsque vous regardez un commit avec Git au travers de votre terminal, il est po...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Lorsque vous regardez un commit avec Git au travers de votre terminal, il est possible que vous utilisez l'argument "pretty". Par exemple, voici un exemple d'utilisation possible :

1

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

--abbrev-commit

Au travers du code source de git, on peut retrouver le fichier qui effectue le "format" de sortie dans votre terminale dans le fichier git/pretty.c. Il contient la fonction suivante qui va nous intéresser pour la suite :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

static int is_rfc2047_special(char ch, enum

rfc2047_type type)

{

/*

* rfc2047, section 4.2:

*

* 8-bit values which correspond to printable ASCII characters other

* than "=", "?", and "_" (underscore), MAY be represented as those

* characters. (But see section 5 for restrictions.) In

* particular, SPACE and TAB MUST NOT be represented as themselves

* within encoded words.

*/

/*

* rule out non-ASCII characters and non-printable characters (the

* non-ASCII check should be redundant as isprint() is not localized

* and only knows about ASCII, but be defensive about that)

*/

if (non_ascii(ch) || !

isprint(ch))

return 1

;

/*

* rule out special printable characters (' ' should be the only

* whitespace character considered printable, but be defensive and use

* isspace())

*/

if (isspace(ch) || ch == '=' || ch == '?' || ch == '_'

)

return 1

;

/*

* rfc2047, section 5.3:

*

* As a replacement for a 'word' entity within a 'phrase', for example,

* one that precedes an address in a From, To, or Cc header. The ABNF

* definition for 'phrase' from RFC 822 thus becomes:

*

* phrase = 1*( encoded-word / word )

*

* In this case the set of characters that may be used in a "Q"-encoded

* 'encoded-word' is restricted to: <upper and lower case ASCII

* letters, decimal digits, "!", "*", "+", "-", "/", "=", and "_"

* (underscore, ASCII 95.)>. An 'encoded-word' that appears within a

* 'phrase' MUST be separated from any adjacent 'word', 'text' or

* 'special' by 'linear-white-space'.

*/

if (type !=

RFC2047_ADDRESS)

return 0

;

/* '=' and '_' are special cases and have been checked above */

return !(isalnum(ch) || ch == '!' || ch == '*' || ch == '+' || ch == '-' || ch == '/'

);

}

Pour la fonction ci-dessus :

Combien de test faut-il pour satisfaire la couverture des branches ?  

Combien de test faut-il pour satisfaire la couverture des conditions ?  

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.polymtl.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!